如何卸载AS3的swf?

时间:2009-11-16 22:01:57

标签: flash actionscript-3

在加载下一个swf之前,任何人都可以帮我解决如何卸载swf?

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);
}

3 个答案:

答案 0 :(得分:1)

您希望将Flash Player 10作为目标,这样您就可以使用unloadAndStop(),但是.unload会让您在那里获得一部分。

http://www.gskinner.com/blog/archives/2008/07/additional_info.html

答案 1 :(得分:0)

mLoader.unload()

答案 2 :(得分:0)

请尝试使用unloadAndStop()。