all groups > flash actionscript > december 2006 >
You're in the

flash actionscript

group:

problems with loadClip & unloadClip


problems with loadClip & unloadClip ella918
12/1/2006 9:58:36 PM
flash actionscript:
I'm loading an external swf file on frame 9 using loadClip and on a button is
the unload clip. My problem is that when I preview the button is clicked the
movie is gone, but it puts me back to frame 1. I've attached the code for the
loadClip and what's on the button. I don't have the .fla files for the swf, so
I don't know if that's whats causing the problem.

I'm doing something similar with another swf and it works fine.

This is code on the button:

on (release) {
utgRain_mcl.unloadClip(mcUtgRain);
nextFrame();

}

Any suggestions would be appreciated.




this.createEmptyMovieClip("mcUtgRain", this.getNextHighestDepth());
var utgRListener:Object = new Object();
utgRListener.onLoadInit = function(targetMC:MovieClip) {
trace("movie loaded");
mcUtgRain.onEnterFrame = function() {
if (mcUtgRain._currentframe == mcUtgRain._totalframes) {
trace("frame# = " + mcUtgRain._currentframe);
mcUtgRain.stop();
delete this.onEnterFrame; // stop the check on each frame
}
}
}
var utgRain_mcl:MovieClipLoader = new MovieClipLoader();

}
utgRain_mcl.addListener(utgRListener);
utgRain_mcl.loadClip("utg-02.swf", mcUtgRain);
mcUtgRain._x=220;
mcUtgRain._y=210;
Re: problems with loadClip & unloadClip sly one
12/1/2006 10:42:53 PM
Not sure what you are trying to do there. Here's how I would do it:


//---------set up MCL:
var utgRain_mcl:MovieClipLoader = new MovieClipLoader();
var utgRListener:Object = new Object();


//---------checks:
utgRListener.onLoadProgress = function(targetMC:MovieClip, bytesLoaded:Number,
bytesTotal:Number):Void {
//progress bar
preload_bar._width=((bytesLoaded/bytesTotal)*100);
}
utgRListener.onLoadInit = function(targetMC:MovieClip):Void {
trace("swf loaded");
}


//----------associate listener with mcl:
utgRain_mcl.addListener(utgRListener);



//---------create receiver clip
this.createEmptyMovieClip("mcUtgRain", this.getNextHighestDepth());



//---------set up button (give it an instance name of utgButton):
utgButton.onRelease=function():Void{
utgRain_mcl.unloadClip(mcUtgRain);
}


//---------start the process:
utgRain_mcl.loadClip("utg-02.swf", mcUtgRain);
mcUtgRain._x=220;
mcUtgRain._y=210;
Re: problems with loadClip & unloadClip DrFrankenscript
12/3/2006 7:51:43 PM
I know [b]I[/b] didn't ask for it, but thanks for your help sly one! I've been
wrecking my brain on this issue for some time.

[movieclip loader instance].unloadClip([created movieclip]);

You rock!!!
AddThis Social Bookmark Button