I load and unload several clips dynamically. Does anyone know how to
unload a loaded movie and its corresponding classes completely?
For instance, if I have a base swf, which I will A .
Clip A then loads clips B.
Clip A then unloads clip B
Clip A then loads clip C
Clips B and C share a common class (LoaderTest.as) file. If clip B is
published with one version of the class, and then changes are made to
class and clip C is published with another version, clips C's version
changes are never reflected. Clip B's version seems to be "stuck" in
the VM. It could be that I am not unloading clip B correctly, but I
have tried everything I can think of.
Here is the code:
-----------------------------A.fla--------------------------------------
-------
trace("Starting");
var _mc:MovieClip;
var _mcl:MovieClipLoader;
_global.A = this;
loadHandler("B.swf");
function loadHandler(data:String){
_mc = this.createEmptyMovieClip("screen_mc",99);//99 because
I was using the Alert component (POS)
var loadInit:Function = function(ref):Void{
ref.init();
}
loader(screen_mc, data, loadInit, "A");
}
function loader(_clip:MovieClip, _path:String, loadInit:Function,
callee_name:String):Void{
_mcl = new MovieClipLoader();
var loader_obj = new Object();
loader_obj.loadInit = loadInit;
_mcl.addListener(loader_obj);
_mcl.loadClip(_path,_clip);
}
function navigate(nav:Number)
{
screen_mc.unloadClip();
_mcl.unloadClip(screen_mc);
_mc.unloadMovie();
unloadMovie ("_root.screen_mc");
_mc.removeMovieClip();
screen_mc = null;
delete screen_mc;
delete _mcl;
delete _mc;
if(nav == 0)
loadHandler("B.swf");
else
loadHandler("C.swf");
}
-----------------------------B.fla--------------------------------------
-------
import test.loader.LoaderTest;
LoaderTest.output();
var base = this;
next_item.onRelease = function() {
trace("ACTION");
_global.A.navigate(1);
unloadMovie(base);
};
-----------------------------C.fla--------------------------------------
-------
import test.loader.LoaderTest;
LoaderTest.output();
previous_Item.onRelease = function (){
trace("ACTION");
_global.A.navigate(0);
};
----------------------------- LoaderTest
---------------------------------------------
class test.loader.LoaderTest {
public function LoaderTest()
{
trace("Loader running");
}
public static function output()
{
trace("Loader running");
//comment above and uncomment below to see
change
// trace("Loader should print out something
different");
}
}
****************************************************************************
This email may contain confidential material.
If you were not an intended recipient,
Please notify the sender and delete all copies.
We may monitor email to and from our network.
****************************************************************************
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com