Unload parent movie after onloadInit of child movie
Hi,
I am loading external swf's into a main load.swf, using a Moviecliploader object. What I basically want to do is that, after an external movie, say home.swf, loads another external swf, say about.swf, home.swf should be unloaded.
home.swf is loading about.swf into the _root.mc_holder, which is placed inside load.swf. I want all external files to be placed within this holder. Now this is working with some files, but not with others. My standard code within all files is this:
//code within home.swf to load about.swf
var loader:MovieClipLoader = new MovieClipLoader();
var ldrlistener = new Object();
loader.addListener(ldrlistener);
ldrlistener.onLoadStart = function(_mc:MovieClip) {
trace("about loading started");
};
ldrlistener.onLoadProgress = function(_mc:MovieClip, loaded:Number, total:Number) {
var prcnt:Number = Math.floor((loaded/total)*100);
if (prcnt == 10) {
trace("loading:10");
ldgraphic.gotoAndStop("ten");
}
if (prcnt == 15) {
trace("loading:15");
ldgraphic.gotoAndStop("fifteen");
}
if (prcnt == 20) {
trace("loading:20");
ldgraphic.gotoAndStop("twenty");
}
if (prcnt == 25) {
trace("loading:25");
ldgraphic.gotoAndStop("twentyfive");
}
if (prcnt == 30) {
trace("loading:30");
ldgraphic.gotoAndStop("thirty");
}
if (prcnt == 40) {
trace("loading:40");
ldgraphic.gotoAndStop("forty");
}
if (prcnt == 50) {
trace("loading:50");
ldgraphic.gotoAndStop("fifty");
}
if (prcnt == 55) {
trace("loading:55");
ldgraphic.gotoAndStop("fiftyfive");
}
if (prcnt == 60) {
trace("loading:60");
ldgraphic.gotoAndStop("sixty");
}
if (prcnt == 70) {
trace("loading:70");
ldgraphic.gotoAndStop("seventy");
}
if (prcnt == 80) {
trace("loading:80");
ldgraphic.gotoAndStop("eighty");
}
if (prcnt == 100) {
trace("loading:100");
ldgraphic.gotoAndStop("hundred");
}
};
ldrlistener.onLoadInit = function(_mc:MovieClip) {
ldgraphic._alpha = 0;
trace("load completed");
};
loader.loadClip("about.swf",_root.mc_holder);
this.unloadMovie(); //unloads home.swf, which was loaded from load.swf
Now the problem is, it is successfully unloading the movie, but after a while it stops doing this. Is there something wrong with the code?? Any help will be greatly appreciated.