简体   繁体   English

如何使用AS3卸载SWF文件?

[英]how can I unload a swf with AS3?

Any body can help on how I can do to unload a swf before I load the next one? 在加载下一个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);
}

You'll hopefully be targeting Flash Player 10 so you can use unloadAndStop(), but .unload should get you part of the way there. 希望您可以将目标指向Flash Player 10,以便可以使用unloadAndStop(),但是.unload应该可以帮助您实现目标。

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

mLoader.unload()

尝试改用unloadAndStop()。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何完全停止和卸载AS3中外部加载的SWF声音? - How to completely stop and unload external loaded SWF sounds in AS3? Flash AS3完全卸载已加载的SWF - Flash AS3 unload loaded SWF completely 如何卸载已经在ActionScript3上的文件中加载的SWF文件 - How can I unload an SWF that is already loaded to my file on actionscript3 承载AS2 SWF的AS3 SWF如何共享同一阵列? - How can an AS3 swf hosting an AS2 swf share the same array? 如何卸载外部“ .swf”文件来加载另一个文件? - How do I unload an external “.swf” file to load another? 如何使用ActionScript 3卸载或删除外部加载的SWF? - How do I unload or remove externally loaded SWF using Actionscript 3? 在Firefox SWF中,“ jQuery”选项卡组件中的内容不会像在Chrome和Safari中那样加载/卸载。 我怎样才能解决这个问题? - In Firefox SWF content in Jquery tabs component doesn't load/unload like in Chrome and Safari. How can i fix this? 需要从Array..cs4 as3卸载外部swf - Need to unload an external swf from Array..cs4 as3 如何在由AS3 SWF托管的AS2 SWF中调用函数,并将数组返回给AS3 SWF? (使用SwfBridge) - How do I call a function in an AS2 swf hosted by an AS3 swf and return an array back to AS3 swf? (using SwfBridge) AS3如何控制对等实例SWF中的动画片段? - AS3 how do I control a movieclip in a peer to peer instance swf?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM