how can I unload a swf with AS3?
Posted
by Ole Media
on Stack Overflow
See other posts from Stack Overflow
or by Ole Media
Published on 2009-11-16T22:01:57Z
Indexed on
2010/03/23
18:43 UTC
Read the original article
Hit count: 432
Any body can help on how I can do to unload a swf before I load the next one?
var mLoader:Loader = new Loader();
function loadSWF(e:Event):void {
var imageId:Array = e.target.name.split("_");
var targetId:int = imageId[0];
var caption:int = imageId[1];
txt = arrayText[caption];
dynText1.text = "";
dynText1.text = arrayText[caption];
dynText1.setTextFormat(textFormatMain);
var swf:String = "swf/" + xmlList[targetId].image[caption].@swf;
if (mLoader.content != null)
{
swfLoad.swfArea.mLoader.unload();
swfLoad.swfArea.mLoader.load(null);
}
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
mLoader.load(new URLRequest(swf));
}
//-------------------------------------------------------------------------//
function onCompleteHandler(loadEvent:Event):void
{
swfLoad.swfArea.addChild(loadEvent.currentTarget.content);
TweenLite.to(swfLoad, 0.5, {alpha:1});
}
function onProgressHandler(mProgress:ProgressEvent):void
{
//var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
//trace(percent);
}
© Stack Overflow or respective owner