Unload SWF File

Hi,
I'm trying to develop a portal application.  I'm loading all swf files in a trusted sandbox configuration.
When i unload the swf file as follows (note autoLoad set to true):
swfLoader.source = null;
swfLoader.validateNow();
But when i run the profiler i notice that the application loaded on the swf file is never garbage collected (i.e. there is an instance for every time i load the swf file).
When i look at what has references to the application i get the following:
Is there a standard method for removing reference to the application so that it is unloaded.  Currently my application is vanilla and contains nothing within the mxml.

Here it is.  Did not see anything out of ordinary.
<report>
  <scripts>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\flex.swc(mx/core/IUIComponent)" mod="1259075989629" size="4563" optimizedsize="1152">
      <def id="mx.core:IUIComponent" />
      <pre id="Object" />
      <pre id="mx.core:IFlexDisplayObject" />
      <dep id="mx.managers:ISystemManager" />
      <dep id="AS3" />
      <dep id="flash.display:DisplayObjectContainer" />
      <dep id="flash.display:DisplayObject" />
      <dep id="flash.display:Sprite" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/utils/RPCObjectUtil)" mod="1259075940689" size="7130" optimizedsize="5264">
      <def id="mx.utils:RPCObjectUtil" />
      <pre id="Object" />
      <dep id="flash.utils:describeType" />
      <dep id="flash.utils:getQualifiedClassName" />
      <dep id="Date" />
      <dep id="AS3" />
      <dep id="QName" />
      <dep id="flash.xml:XMLNode" />
      <dep id="XML" />
      <dep id="mx.core:mx_internal" />
      <dep id="XMLList" />
      <dep id="flash.utils:Dictionary" />
      <dep id="Error" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\flex.swc(mx/core/IChildList)" mod="1259075989520" size="1480" optimizedsize="497">
      <def id="mx.core:IChildList" />
      <pre id="Object" />
      <dep id="AS3" />
      <dep id="flash.display:DisplayObject" />
      <dep id="flash.geom:Point" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/messaging/config/ConfigMap)" mod="1259075949283" size="2285" optimizedsize="1019">
      <def id="mx.messaging.config:ConfigMap" />
      <pre id="flash.utils:Proxy" />
      <dep id="AS3" />
      <dep id="flash.utils:flash_proxy" />
      <dep id="mx.utils:object_proxy" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/utils/RPCUIDUtil)" mod="1259075940689" size="2858" optimizedsize="1848">
      <def id="mx.utils:RPCUIDUtil" />
      <pre id="Object" />
      <dep id="Date" />
      <dep id="flash.utils:ByteArray" />
      <dep id="AS3" />
      <dep id="Math" />
      <dep id="mx.core:mx_internal" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\flex.swc(mx/core/IButton)" mod="1259075988989" size="642" optimizedsize="230">
      <def id="mx.core:IButton" />
      <pre id="mx.core:IUIComponent" />
      <pre id="Object" />
      <dep id="AS3" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\flex.swc(mx/managers/IFocusManager)" mod="1259075991942" size="2728" optimizedsize="773">
      <def id="mx.managers:IFocusManager" />
      <pre id="Object" />
      <dep id="mx.core:IButton" />
      <dep id="mx.managers:IFocusManagerComponent" />
      <dep id="flash.events:IEventDispatcher" />
      <dep id="AS3" />
      <dep id="flash.display:InteractiveObject" />
      <dep id="flash.display:DisplayObject" />
      <dep id="flash.display:Sprite" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/messaging/messages/IMessage)" mod="1259075949565" size="1995" optimizedsize="409">
      <def id="mx.messaging.messages:IMessage" />
      <pre id="Object" />
      <dep id="AS3" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/messaging/messages/RemotingMessage)" mod="1259075949830" size="654" optimizedsize="264">
      <def id="mx.messaging.messages:RemotingMessage" />
      <pre id="mx.messaging.messages:AbstractMessage" />
      <dep id="AS3" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\flex.swc(mx/core/mx_internal)" mod="1259075988989" size="190" optimizedsize="109">
      <def id="mx.core:mx_internal" />
      <dep id="AS3" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\flex.swc(mx/core/IFlexDisplayObject)" mod="1259075989661" size="6251" optimizedsize="1339">
      <def id="mx.core:IFlexDisplayObject" />
      <pre id="flash.events:IEventDispatcher" />
      <pre id="flash.display:IBitmapDrawable" />
      <pre id="Object" />
      <dep id="flash.accessibility:AccessibilityProperties" />
      <dep id="AS3" />
      <dep id="flash.display:DisplayObjectContainer" />
      <dep id="flash.geom:Rectangle" />
      <dep id="flash.display:DisplayObject" />
      <dep id="flash.display:Stage" />
      <dep id="flash.display:LoaderInfo" />
      <dep id="flash.geom:Point" />
      <dep id="flash.geom:Transform" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/messaging/messages/ISmallMessage)" mod="1259075949815" size="571" optimizedsize="196">
      <def id="mx.messaging.messages:ISmallMessage" />
      <pre id="Object" />
      <pre id="mx.messaging.messages:IMessage" />
      <dep id="AS3" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Source\Core\unithru_core_client_loader_flex\src\main.as" mod="1285282178028" size="2225" optimizedsize="1525">
      <def id="main" />
      <pre id="flash.display:Sprite" />
      <dep id="flash.display:StageScaleMode" />
      <dep id="flash.events:Event" />
      <dep id="mx.messaging.messages:MessagePerformanceInfo" />
      <dep id="mx.messaging.messages:HTTPRequestMessage" />
      <dep id="mx.messaging.messages:AcknowledgeMessage" />
      <dep id="flash.net:URLRequest" />
      <dep id="mx.messaging.messages:CommandMessage" />
      <dep id="flash.display:Loader" />
      <dep id="flash.system:ApplicationDomain" />
      <dep id="Error" />
      <dep id="mx.messaging.messages:SOAPMessage" />
      <dep id="mx.messaging.messages:AsyncMessageExt" />
      <dep id="flash.system:SecurityDomain" />
      <dep id="mx.managers:ISystemManager" />
      <dep id="mx.messaging.messages:RemotingMessage" />
      <dep id="mx.messaging.messages:AcknowledgeMessageExt" />
      <dep id="AS3" />
      <dep id="mx.messaging.config:ConfigMap" />
      <dep id="mx.events:FlexEvent" />
      <dep id="mx.messaging.messages:ErrorMessage" />
      <dep id="flash.system:LoaderContext" />
      <dep id="mx.messaging.messages:AsyncMessage" />
      <dep id="flash.display:StageAlign" />
      <dep id="mx.messaging.messages:CommandMessageExt" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\flex.swc(mx/managers/ISystemManager)" mod="1259075991958" size="4795" optimizedsize="1386">
      <def id="mx.managers:ISystemManager" />
      <pre id="mx.core:IFlexModuleFactory" />
      <pre id="flash.events:IEventDispatcher" />
      <pre id="mx.core:IChildList" />
      <pre id="Object" />
      <dep id="flash.events:Event" />
      <dep id="mx.managers:IFocusManagerContainer" />
      <dep id="flash.text:TextFormat" />
      <dep id="AS3" />
      <dep id="mx.core:ISWFBridgeGroup" />
      <dep id="flash.geom:Rectangle" />
      <dep id="flash.display:DisplayObject" />
      <dep id="flash.display:Stage" />
      <dep id="flash.display:LoaderInfo" />
      <dep id="flash.display:Sprite" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\flex.swc(mx/core/IFlexModuleFactory)" mod="1259075988973" size="976" optimizedsize="297">
      <def id="mx.core:IFlexModuleFactory" />
      <pre id="Object" />
      <dep id="AS3" />
      <dep id="flash.utils:Dictionary" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/messaging/messages/SOAPMessage)" mod="1259075949815" size="1271" optimizedsize="699">
      <def id="mx.messaging.messages:SOAPMessage" />
      <pre id="mx.messaging.messages:HTTPRequestMessage" />
      <dep id="AS3" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\flex.swc(mx/core/ISWFBridgeGroup)" mod="1259075989676" size="1224" optimizedsize="397">
      <def id="mx.core:ISWFBridgeGroup" />
      <pre id="Object" />
      <dep id="flash.events:IEventDispatcher" />
      <dep id="AS3" />
      <dep id="mx.core:ISWFBridgeProvider" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\flex.swc(mx/events/FlexEvent)" mod="1259076013693" size="2417" optimizedsize="1480">
      <def id="mx.events:FlexEvent" />
      <pre id="flash.events:Event" />
      <dep id="AS3" />
      <dep id="mx.core:mx_internal" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\framework.swc(mx/utils/object_proxy)" mod="1259075999614" size="208" optimizedsize="125">
      <def id="mx.utils:object_proxy" />
      <dep id="AS3" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/messaging/messages/ErrorMessage)" mod="1259075949565" size="1063" optimizedsize="541">
      <def id="mx.messaging.messages:ErrorMessage" />
      <pre id="mx.messaging.messages:AcknowledgeMessage" />
      <dep id="AS3" />
      <dep id="mx.messaging.messages:IMessage" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\flex.swc(mx/core/ISWFBridgeProvider)" mod="1259075989676" size="785" optimizedsize="263">
      <def id="mx.core:ISWFBridgeProvider" />
      <pre id="Object" />
      <dep id="flash.events:IEventDispatcher" />
      <dep id="AS3" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/messaging/messages/CommandMessageExt)" mod="1259075949799" size="1008" optimizedsize="464">
      <def id="mx.messaging.messages:CommandMessageExt" />
      <pre id="mx.messaging.messages:CommandMessage" />
      <pre id="flash.utils:IExternalizable" />
      <dep id="AS3" />
      <dep id="flash.utils:IDataOutput" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/messaging/messages/HTTPRequestMessage)" mod="1259075949565" size="1757" optimizedsize="880">
      <def id="mx.messaging.messages:HTTPRequestMessage" />
      <pre id="mx.messaging.messages:AbstractMessage" />
      <dep id="AS3" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/messaging/messages/CommandMessage)" mod="1259075949799" size="4385" optimizedsize="2638">
      <def id="mx.messaging.messages:CommandMessage" />
      <pre id="mx.messaging.messages:AsyncMessage" />
      <dep id="AS3" />
      <dep id="flash.utils:IDataOutput" />
      <dep id="flash.utils:IDataInput" />
      <dep id="mx.messaging.messages:IMessage" />
      <dep id="mx.messaging.messages:CommandMessageExt" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/messaging/messages/AcknowledgeMessage)" mod="1259075949815" size="1725" optimizedsize="938">
      <def id="mx.messaging.messages:AcknowledgeMessage" />
      <pre id="mx.messaging.messages:ISmallMessage" />
      <pre id="mx.messaging.messages:AsyncMessage" />
      <dep id="mx.messaging.messages:AcknowledgeMessageExt" />
      <dep id="AS3" />
      <dep id="flash.utils:IDataOutput" />
      <dep id="flash.utils:IDataInput" />
      <dep id="mx.messaging.messages:IMessage" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/messaging/messages/AsyncMessage)" mod="1259075949799" size="2629" optimizedsize="1411">
      <def id="mx.messaging.messages:AsyncMessage" />
      <pre id="mx.messaging.messages:ISmallMessage" />
      <pre id="mx.messaging.messages:AbstractMessage" />
      <dep id="mx.messaging.messages:AsyncMessageExt" />
      <dep id="flash.utils:ByteArray" />
      <dep id="AS3" />
      <dep id="flash.utils:IDataOutput" />
      <dep id="flash.utils:IDataInput" />
      <dep id="mx.messaging.messages:IMessage" />
      <dep id="mx.utils:RPCUIDUtil" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/utils/RPCStringUtil)" mod="1259075940689" size="1722" optimizedsize="959">
      <def id="mx.utils:RPCStringUtil" />
      <pre id="Object" />
      <dep id="AS3" />
      <dep id="mx.core:mx_internal" />
      <dep id="RegExp" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\flex.swc(mx/managers/IFocusManagerComponent)" mod="1259075999302" size="1320" optimizedsize="326">
      <def id="mx.managers:IFocusManagerComponent" />
      <pre id="Object" />
      <dep id="AS3" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/messaging/messages/MessagePerformanceInfo)" mod="1259075949799" size="1491" optimizedsize="730">
      <def id="mx.messaging.messages:MessagePerformanceInfo" />
      <pre id="Object" />
      <dep id="Date" />
      <dep id="AS3" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/messaging/messages/AcknowledgeMessageExt)" mod="1259075949815" size="1044" optimizedsize="476">
      <def id="mx.messaging.messages:AcknowledgeMessageExt" />
      <pre id="mx.messaging.messages:AcknowledgeMessage" />
      <pre id="flash.utils:IExternalizable" />
      <dep id="AS3" />
      <dep id="flash.utils:IDataOutput" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/messaging/messages/AbstractMessage)" mod="1259075949815" size="6545" optimizedsize="3334">
      <def id="mx.messaging.messages:AbstractMessage" />
      <pre id="Object" />
      <pre id="mx.messaging.messages:IMessage" />
      <dep id="mx.utils:RPCObjectUtil" />
      <dep id="flash.utils:getQualifiedClassName" />
      <dep id="flash.utils:ByteArray" />
      <dep id="AS3" />
      <dep id="flash.utils:IDataOutput" />
      <dep id="mx.core:mx_internal" />
      <dep id="flash.utils:IDataInput" />
      <dep id="mx.utils:RPCStringUtil" />
      <dep id="mx.utils:RPCUIDUtil" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\rpc.swc(mx/messaging/messages/AsyncMessageExt)" mod="1259075949799" size="968" optimizedsize="438">
      <def id="mx.messaging.messages:AsyncMessageExt" />
      <pre id="flash.utils:IExternalizable" />
      <pre id="mx.messaging.messages:AsyncMessage" />
      <dep id="AS3" />
      <dep id="flash.utils:IDataOutput" />
    </script>
    <script name="C:\work\sisa\snapshot\cc\unithru_rrubio_view\UniThru\Tools\FlexSDK3.5\3.5.0\frameworks\libs\flex.swc(mx/managers/IFocusManagerContainer)" mod="1259075999286" size="1056" optimizedsize="358">
      <def id="mx.managers:IFocusManagerContainer" />
      <pre id="flash.events:IEventDispatcher" />
      <pre id="Object" />
      <dep id="mx.managers:ISystemManager" />
      <dep id="AS3" />
      <dep id="flash.display:DisplayObject" />
      <dep id="mx.managers:IFocusManager" />
    </script>
  </scripts>
  <external-defs>
    <ext id="flash.utils:ByteArray" />
    <ext id="Math" />
    <ext id="RegExp" />
    <ext id="flash.system:ApplicationDomain" />
    <ext id="flash.display:StageAlign" />
    <ext id="XMLList" />
    <ext id="flash.events:Event" />
    <ext id="AS3" />
    <ext id="flash.utils:describeType" />
    <ext id="flash.net:URLRequest" />
    <ext id="flash.utils:IDataOutput" />
    <ext id="XML" />
    <ext id="flash.display:InteractiveObject" />
    <ext id="flash.display:LoaderInfo" />
    <ext id="flash.events:IEventDispatcher" />
    <ext id="flash.geom:Rectangle" />
    <ext id="QName" />
    <ext id="flash.utils:Dictionary" />
    <ext id="Error" />
    <ext id="flash.system:SecurityDomain" />
    <ext id="flash.display:IBitmapDrawable" />
    <ext id="Date" />
    <ext id="flash.display:DisplayObject" />
    <ext id="flash.accessibility:AccessibilityProperties" />
    <ext id="Object" />
    <ext id="flash.utils:IDataInput" />
    <ext id="flash.utils:flash_proxy" />
    <ext id="flash.display:DisplayObjectContainer" />
    <ext id="flash.text:TextFormat" />
    <ext id="flash.xml:XMLNode" />
    <ext id="flash.utils:IExternalizable" />
    <ext id="flash.display:Sprite" />
    <ext id="flash.display:Loader" />
    <ext id="flash.utils:Proxy" />
    <ext id="flash.geom:Point" />
    <ext id="flash.display:Stage" />
    <ext id="flash.system:LoaderContext" />
    <ext id="flash.geom:Transform" />
    <ext id="flash.utils:getQualifiedClassName" />
    <ext id="flash.display:StageScaleMode" />
  </external-defs>
</report>

Similar Messages

  • How to unload swf file?

    I was wondering what are the codes for unloading the swf file after i hit the return button key????
    I tried removeChild(); but still exits in the menu page after i hit the return button key.

    no.  if you're not using a loader to load a swf, you can't use the unload() method.  and there is no unLoad() method.
    if you want to remove everything from the stage in your main swf, you can use removeF() from the main timeline:
    removeF(this);
    function removeF(mc):void{
    for(var i:int=0;i<mc.numChildren;i++){
        mc.removeChildAt(0);

  • Unload swf file using SWFLoader

    Hi,
    I have a main application where I am using a SWFLoader to load a second application.
    In the second application I want to put a button (Close) and when I click it I want to unload this application.
    Is it possible to achieve this?
    I know that I can unload a swf file using the unloadAndStop method of SWFLoader, but how can I access it from the loaded application?
    I think that another approach would be adding eventlisteners to loaded swf but I am not sure how to do that.
    Does anyone can help me?
    Thanks in advance,
    Alberto

    Hi,
    @Alberto
    I think that another approach would be adding eventlisteners to loaded swf but I am not sure how to do that.
    I think you could use custom or built-in event type to dispatch information to hosting application and SWFLoader *has* built-in dedicated routine to unload loaded context - which includes removing event listeners added to swf-types on content load (Yes, there are means in Flex SDK to access top-most application but usually that is not advised to access methods/properties of parent as it closely ties content together).
    So your parent application could start to listen for custom event when load completes and removes loaded app that way:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx">
         <fx:Script>
              <![CDATA[
                   protected function chidLoadedHandler(event:Event):void
                        swfLoader.content.addEventListener(Event.CLOSE, unloadChildHandler);
                   protected function unloadChildHandler(event:Event):void
                        swfLoader.content.removeEventListener(Event.CLOSE, unloadChildHandler);
                        swfLoader.unloadAndStop(true);
              ]]>
         </fx:Script>
         <s:SWFLoader
              width="100%" height="100%"
              source="ChildApplication.swf"
              complete="chidLoadedHandler(event)"
              id="swfLoader"/>
    </s:Application>
    while your child application simply:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx">
         <fx:Script>
              <![CDATA[
                   protected function unloadMeHandler(event:MouseEvent):void
                        // we will dispatch "CLOSE" event - this could be custom event type
                        // but I think it is just enoguht heres
                        var closeEvent:Event = new Event(Event.CLOSE);
                        // root is top-most - so it is "content" top-most display object as well
                        this.root.dispatchEvent(closeEvent);
              ]]>
         </fx:Script>
         <!-- ui -->
         <s:Button x="10" y="10" label="Unload me" click="unloadMeHandler(event)" id="unloadButton"/>
    </s:Application>
    Not sure if that is most bullet proof or recommended solution but could be place to start,
    regards,
    Peter

  • Load and unload swf file

    I am currently using AS2.
    I create a button instance named "myBtn" and i want it to load external swf file call "test2.swf" while unload current swf file named "test1.swf"  when pressed/release.
    what done is i put following code under mybtn :
    on(press)
              unloadMovie("test1.swf");
              loadMovie("test2.swf" , 1);
    the outcome was that , the "test2.swf" was loaded successfully but the "test1.swf" fail to unload.
    Any help is welcome

    AS2.. Scope is your issue. When you are inside the function for onPress you are telling the button you pressed to unload test1.swf from inside that button (which it's not located in).
    You're probably using the root timeline so I'll take a wager this will work:
    on (press)
         _root.loadMovie("test2.swf");
    If you want to monitor progress in loading between them, that's a little more complex.

  • Help with load and unload swf file.

    hello, just now i try, to  load my file using the code snippet 'load and unload' i manage to load the next file succesfully but why my recent file still appear in the background? how do i make it gone?

    When you load another SWF you're loading it 'inside' the current SWF but it appears that you want to replace the current SWF entirely with the new SWF, is that correct?
    If so you should make what's usually known as a 'stub' or a loader. Make an empty project that merely acts as a loader. It should load your first SWF and when you press a button on that first SWF to load a second SWF, it should signal the 'stub' it's loaded inside to unload the first SWF and then load the second.
    e.g. a stub.swf (just coding out of memory, not error checked, just to give a general idea):
    // make a new loader to do all the loading of SWFs
    var loader:Loader = new Loader();
    // and display
    addChild(loader);
    // a function to load a SWF into the loader (replacing any existing SWF)
    function loadSWF(path:String):void
         // assure path is defined or do nothing
         if (!path) return;
         // load requested SWF
         loader.load(new URLRequest(path));    
    // load initial SWF
    loadSWF('/path/to/1.swf');
    For your 1.swf to use the function, you're currently inside the .content property of a Loader so I believe you can just run a command like: Object(this.parent.parent).loadSWF('/path/to/2.swf');
    This example obviously lacks any error checking or transitions but you can add those and season to taste.

  • Need to load and unload swf from single htm file

    I need to load or unload swf file or we can say that i need load 3 project one by one in current window

    mit,
    So are you saying you need to have one swf file call a second file to play, then call a third to play...
    Which Captivate version are you using?
    Are the swf files all captivate published swf's?
    Do you have access to Flash Professional and if so what version?
    how are you running your file, is it scorm packaged or just html based?
    I may be able to help with your issue, but need these details.

  • SWFLoader.unloadAndStop() - does it unload swf and release memory?

    Hi all,
    Do SWFLoader FP10 unloadAndStop() and GC really unload swf?
    I have simpliest test case possible when parent app creates new SWFLoader, loads sub app and then unloads it.
    Every time when it does it I see memory grows. The sub app is tiny:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Label id="idLabel" color="blue" text="This is embedded application."/>   
    </mx:Application>
    The parent application is also simple
    public function loadSwf(name:String):void
      loader.addEventListener(Event.COMPLETE, completeHandle, false, 0, true);   
      loader.showBusyCursor = true;
      loader.scaleContent = true;
      loader.source=name;     // name is subappswf.swf the
      loader.load();
    private function completeHandle(event:Event):void
      loader.removeEventListener(Event.COMPLETE, completeHandle);
      loader.unloadAndStop(true);
    Profiler shows decent Peak Memory and even Cumulative Memory does not seem horrible. There are no objects hanging in sub-application except SystemManager. But Google Chrom Task Manager shows the real picture:  Shockwave Flash memory grows and as soon it reaches threshold ~0.5 GB, application becomes unresponsive and eventually FP crashes.
    What else should be done to free up memory?
    Regards,
    Ilya

    This is iInteresting...
    /*** Unloads an image or SWF file. After this method returns the
    * <code>source</code> property will be null. This is only supported
    * if the host Flash Player is version 10 or greater. If the host Flash
    * Player is less than version 10, then this method will unload the
    * content the same way as if <code>source</code> was set to null.
    * This method attempts to unload SWF files by removing references to
    * EventDispatcher, NetConnection, Timer, Sound, or Video objects of the
    * child SWF file. As a result, the following occurs for the child SWF file
    * and the child SWF file's display list:
    * <ul>
    * <li>Sounds are stopped.</li>
    * <li>Stage event listeners are removed.</li>
    * <li>Event listeners for <code>enterFrame</code>,
    * <code>frameConstructed</code>, <code>exitFrame</code>,
    * <code>activate</code> and <code>deactivate</code> are removed.</li>
    * <li>Timers are stopped.</li>
    * <li>Camera and Microphone instances are detached</li>
    * <li>Movie clips are stopped.</li>
    * </ul>
    * @param invokeGarbageCollector Provides a hint to the garbage collector to run
    * on the child SWF objects (<code>true</code>) or not (<code>false</code>).
    * If you are unloading many objects asynchronously, setting the
    * <code>gc</code> parameter to <code>false</code> might improve application
    * performance. However, if the parameter is set to <code>false</code>, media
    * and display objects of the child SWF file might persist in memory after
    * the child SWF has been unloaded.
    public function unloadAndStop(invokeGarbageCollector:Boolean = true):void
    useUnloadAndStop =
    true;unloadAndStopGC = invokeGarbageCollector;
    source =
    null; // this will cause an unload unless autoload is true
    if (!autoLoad)load(
    null);}
    It means that if autoload is true (default) unload will not happen and sub-app
    will persist in memory.
    Regards,
    Ilya

  • How to load and unload more than one external swf files in different frames?

    I do not have much experience on Adobe Flash or Action Script 3, but I know the basics.
    I am Arabic language teacher, and I design an application to teach Arabic, I just would like to learn how to load and unload more than one external swf files in different frames.
    Thanks

    Look into using the Loader class to load the swf files.  If you want to have it happen in different frames then you can put the code into the different frames.

  • Remove / unload external swf file(s) from the main flash file and load a new swf file and garbage collection from memory.

    I can't seem to remove / unload the external swf files e.g when the carousel.swf (portfolio) is displayed and I press the about button the about content is overlapping the carousel (portfolio) . How can I remove / unload an external swf file from the main flash file and load a new swf file, while at the same time removing garbage collection from memory?
    This is the error message(s) I am receiving: "TypeError: Error #2007: Parameter child must be non-null.
    at flash.display::DisplayObjectContainer/removeChild()
    at index_fla::MainTimeline/Down3()"
    import nl.demonsters.debugger.MonsterDebugger;
    var d:MonsterDebugger=new MonsterDebugger(this);
    stage.scaleMode=StageScaleMode.NO_SCALE;
    stage.align=StageAlign.TOP_LEFT;
    stage.addEventListener(Event.RESIZE, resizeHandler);
    // loader is the loader for portfolio page swf
    var loader:Loader;
    var loader2:Loader;
    var loader3:Loader;
    var loader1:Loader;
    //  resize content
    function resizeHandler(event:Event):void {
        // resizes portfolio page to center
    loader.x = (stage.stageWidth - loader.width) * .5;
    loader.y = (stage.stageHeight - loader.height) * .5;
    // resizes about page to center
    loader3.x = (stage.stageWidth - 482) * .5 - 260;
    loader3.y = (stage.stageHeight - 492) * .5 - 140;
    /*loader2.x = (stage.stageWidth - 658.65) * .5;
    loader2.y = (stage.stageHeight - 551.45) * .5;*/
    addEventListener(Event.ENTER_FRAME, onEnterFrame,false, 0, true);
    function onEnterFrame(ev:Event):void {
    var requesterb:URLRequest=new URLRequest("carouselLoader.swf");
    loader = null;
    loader = new Loader();
    loader.name ="carousel1"
    //adds gallery.swf to stage at begining of movie
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader.load(requesterb);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader);
    loader.x = (stage.stageWidth - 739) * .5;
    loader.y = (stage.stageHeight - 500) * .5;
    // stop gallery.swf from duplication over and over again on enter frame
    removeEventListener(Event.ENTER_FRAME, onEnterFrame);
    //PORTFOLIO BUTTON
    //adds eventlistner so that gallery.swf can be loaded
    MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    function Down(event:MouseEvent):void {
    // re adds listener for contact.swf and about.swf
    MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
    MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    //unloads gallery.swf from enter frame if users presses portfolio button in nav
    var requester:URLRequest=new URLRequest("carouselLoader.swf");
        loader = null;
    loader = new Loader();
    loader.name ="carousel"
    loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader);
    loader.x = (stage.stageWidth - 739) * .5;
    loader.y = (stage.stageHeight - 500) * .5;
    removeChild( getChildByName("about") );
    removeChild( getChildByName("carousel1") );
    // remove eventlistner and prevents duplication of gallery.swf
    MovieClip(root).nav.portfolio.removeEventListener(MouseEvent.MOUSE_DOWN, Down);
    //INFORMATION BUTTON
    //adds eventlistner so that info.swf can be loaded
    MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
    function Down1(event:MouseEvent):void {
    //this re-adds the EventListener for portfolio so that end user can view again if they wish.
    MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    var requester:URLRequest=new URLRequest("contactLoader.swf");
    loader2 = null;
    loader2 = new Loader();
    loader2.name ="contact"
    loader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader2.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader2);
    loader2.x = (stage.stageWidth - 658.65) * .5;
    loader2.y = (stage.stageHeight - 551.45) * .5;
    // remove eventlistner and prevents duplication of info.swf
    MovieClip(root).nav.info.removeEventListener(MouseEvent.MOUSE_DOWN, Down1);
    //ABOUT BUTTON
    //adds eventlistner so that info.swf can be loaded
    MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    function Down3(event:MouseEvent):void {
    //this re-adds the EventListener for portfolio so that end user can view again if they wish.
    MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
    var requester:URLRequest=new URLRequest("aboutLoader.swf");
    loader3 = null;
    loader3 = new Loader();
    loader3.name ="about"
    loader3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
    function ioError(event:IOErrorEvent):void {
    trace(event);
    try {
    loader3.load(requester);
    } catch (error:SecurityError) {
    trace(error);
    addChild(loader3);
    loader3.x = (stage.stageWidth - 482) * .5 - 260;
    loader3.y = (stage.stageHeight - 492) * .5 - 140;
    removeChild( getChildByName("carousel") );
    removeChild( getChildByName("carousel1") );
    // remove eventlistner and prevents duplication of info.swf
    MovieClip(root).nav.about.removeEventListener(MouseEvent.MOUSE_DOWN, Down3);
    stop();

    Andrei1,
    Thank you for the helpful advice. I made the changes as you suggested but I am receiving a #1009 error message even though my site is working the way I wan it to work. I would still like to fix the errors so that my site runs and error free. This is the error I am receiving:
    "TypeError: Error #1009: Cannot access a property or method of a null object reference."
    I'm sure this is not the best method to unload loaders and I am guessing this is why I am receiving the following error message.
         loader.unload();
         loader2.unload();
         loader3.unload();
    I also tried creating a function to unload the loader but received the same error message and my portfolio swf was not showing at all.
         function killLoad():void{
         try { loader.close(); loader2.close; loader3.close;} catch (e:*) {}
         loader.unload(); loader2.unload(); loader3.unload();
    I have a question regarding suggestion you made to set Mouse Event to "null". What does this do setting the MouseEvent do exactly?  Also, since I've set the MouseEvent to null do I also have to set the loader to null? e.g.
    ---- Here is my updated code ----
    // variable for external loaders
    var loader:Loader;
    var loader1:Loader;
    var loader2:Loader;
    var loader3:Loader;
    // makes borders resize with browser size
    function resizeHandler(event:Event):void {
    // resizes portfolio page to center
         loader.x = (stage.stageWidth - loader.width) * .5;
         loader.y = (stage.stageHeight - loader.height) * .5;
    // resizes about page to center
         loader3.x = (stage.stageWidth - 482) * .5 - 260;
         loader3.y = (stage.stageHeight - 492) * .5 - 140;
    //adds gallery.swf to stage at begining of moviie
         Down();
    //PORTFOLIO BUTTON
    //adds eventlistner so that gallery.swf can be loaded
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
    function Down(event:MouseEvent = null):void {
    // re adds listener for contact.swf and about.swf
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
    //unloads gallery.swf from enter frame if users presses portfolio button in nav
         var requester:URLRequest=new URLRequest("carouselLoader.swf");
         loader = new Loader();
         loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader.load(requester);
         } catch (error:SecurityError) {
         trace(error);
         this.addChild(loader);
         loader.x = (stage.stageWidth - 739) * .5;
         loader.y = (stage.stageHeight - 500) * .5;
    // sure this is not the best way to do this - but it is unload external swfs
         loader.unload();
         loader2.unload();
         loader3.unload();
    // remove eventlistner and prevents duplication of gallery.swf
         MovieClip(root).nav.portfolio.removeEventListener(MouseEvent.MOUSE_DOWN, Down);
    //INFORMATION BUTTON
         //adds eventlistner so that info.swf can be loaded
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         function Down1(event:MouseEvent = null):void {
         //this re-adds the EventListener for portfolio so that end user can view again if they wish.
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
         var requester:URLRequest=new URLRequest("contactLoader.swf");
         loader2 = null;
         loader2 = new Loader();
         loader2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);    
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader2.load(requester);
    }      catch (error:SecurityError) {
         trace(error);
         addChild(loader2);
         loader2.x = (stage.stageWidth - 658.65) * .5;
         loader2.y = (stage.stageHeight - 551.45) * .5;
    loader.unload();
    loader2.unload();
    loader3.unload();
         // remove eventlistner and prevents duplication of info.swf
         MovieClip(root).nav.info.removeEventListener(MouseEvent.MOUSE_DOWN, Down1);
    //ABOUT BUTTON
         //adds eventlistner so that info.swf can be loaded
         MovieClip(root).nav.about.addEventListener(MouseEvent.MOUSE_DOWN, Down3, false, 0, true);
         function Down3(event:MouseEvent = null):void {
         //this re-adds the EventListener for portfolio so that end user can view again if they wish.
         MovieClip(root).nav.portfolio.addEventListener(MouseEvent.MOUSE_DOWN, Down, false, 0, true);
         MovieClip(root).nav.info.addEventListener(MouseEvent.MOUSE_DOWN, Down1, false, 0, true);
         var requester:URLRequest=new URLRequest("aboutLoader.swf");
         loader3 = null;
         loader3 = new Loader();
         loader3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioError);
         function ioError(event:IOErrorEvent):void {
         trace(event);
         try {
         loader3.load(requester);
    }      catch (error:SecurityError) {
         trace(error);
         addChild(loader3);
         loader3.x = (stage.stageWidth - 482) * .5 - 260;
         loader3.y = (stage.stageHeight - 492) * .5 - 140;
         loader.unload();
         loader2.unload();
         loader3.unload();
         // remove eventlistner and prevents duplication of info.swf
         MovieClip(root).nav.about.removeEventListener(MouseEvent.MOUSE_DOWN, Down3);
         stop();

  • How to exit or unload a swf file

    Hi,
    I create a .swf file and couldn’t seem to find actionscript code to exit/unload the file.  I also can’t find code to automatically load a file as a full screen.  I have used the code below but it seems to only works in projector or .exe files but not in the .swf file.
    Exit/Unload:this.btnExit.addEventListener(MouseEvent.CLICK,Exit);
    function Exit(event:MouseEvent):void{
                    fscommand("quit");
    Does anyone have any recommendations?
    Thanks.
    Suoevolat

    This is a link going out to clients - once the link is pressed it opens in a web browser.  It's a 2 minute interactive video presentation.  I have play pause rewind fast forward  and exit buttons so that the user has control. I want the user to be able to exit out of the presentation - closing the browser.  I created this in Flash Professional CS5 and coded using Actionscript 3.
    Many thanks,
    Suovelat

  • How to unload the external .swf file when move on to other section?

    Hi,
    The following code provided by Mr. kglad works great in loading an external .swf file onto stage. Now, when I click on Contact (Button), the external .swf file to be removed completely. How to code on contact (Button) to work it out.
    Gallery.addEventListener(MouseEvent.CLICK, GalleryClick);
    function GalleryClick(e:Event):void{
    if(currentClip != Gallery_mc){
    currentClip.visible = false;
    Gallery_mc.visible =true;
    currentClip =Gallery_mc;}
    var loader:Loader=new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ClipLoaded);
    loader.load(new URLRequest("Gallery.swf"));
    function ClipLoaded(e:Event):void{
    Gallery_mc.addChild(loader);
    loader.x=0;
    loader.y=120;
    loader.width=1000;
    loader.height=700
    I tried the following code for Contact_btn to unload the Gallery.swf file which throws an error: 1120: Access of undefined property loader.
    Contact.addEventListener(MouseEvent.CLICK, ContactClick);
    function ContactClick(e:Event):void{
    if(currentClip != Cotnact_mc){
    currentClip.visible = false;
    Cotnact_mc.visible =true;
    currentClip = Cotnact_mc;
    Gallery_mc.removeChild(loader);}}

    like so:
    Gallery.addEventListener(MouseEvent.CLICK, GalleryClick);
    function GalleryClick(e:Event):void{
    if(currentClip != Gallery_mc){
    currentClip.visible = false;
    Gallery_mc.visible =true;
    currentClip =Gallery_mc;}
    var loader:Loader=new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, ClipLoaded);
    loader.load(new URLRequest("Gallery.swf"));
    function ClipLoaded(e:Event):void{
    loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, ClipLoaded);
    Gallery_mc.addChild(loader);
    loader.x=0;
    loader.y=120;
    loader.width=1000;
    loader.height=700
    I tried the following code for Contact_btn to unload the Gallery.swf file which throws an error: 1120: Access of undefined property loader.
    Contact.addEventListener(MouseEvent.CLICK, ContactClick);
    function ContactClick(e:Event):void{
    if(currentClip != Cotnact_mc){
    currentClip.visible = false;
    Cotnact_mc.visible =true;
    currentClip = Cotnact_mc;
    if(loader){
    if(loader.stage){
    gallery_mc.removeChild(loader);
    loader.unloadAndStop();  // for fp 10+
    loader=null;  // if loader no longer needed

  • Unloading external swf file keeps memory usage growing up

    Hello everybody,
    The idea is very simple: I have a submain.swf with 5 buttons. Each button loads an external .swf file.
    com_loader.load(URLRequest);
    After playing first external swf, before I go to next one, I try to unload it:
    1. remove all its associated listeners:
    com_loader.contentLoaderInfo.removeEventListener(Event.INIT-PROGRESS-COMPLETE, idFunction);
    2. unload it:
    com_loader.unload();
    3. set to null:
    com_loader = null;
    and load next external swf file and so on.
    The problem is that the FireFox/IE8.0 Memory Usage in Task Manager is going up and I see no sign of GC activity even after 5 mins of playing. Can anyone light me up pls? This is the second week working around and no good news until now.
    Thanks in advance.
    P.S.
    If I try com_loader.unloadAndStop(); it gives me the error: Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.
    Vince.

    Hi Ice,
    The loaded swf file contains only a small photo, just for testing, with no listeners or other stuff in it.
    Vic.

  • Facing problem while unloading the SWF file in SWF Loader

    Facing problem with SWF Loader.
    Background:
    I've 4 SWF files (demo1.swf, demo1_skin.swf, demo2.swf and demo2_skin.swf).
    These swf files are created throgh Adobe Captivate.
    Playing demo1_skin, will play the demo1.swf with the controls at the button such as "Play", "Pause", "Stop", "Forward", "Backward" and Seekbar.
    Playing demo2_skin, will play the demo2.swf with the controls at the button such as "Play", "Pause", "Stop", "Forward", "Backward" and Seekbar.
    Scenario:
    1. Clicked on the video1 leaf of the tree. Video1.swf is getting played.
    I am able to click on the seek bar to take the video pointer to the desired position. I can drag the seek bar forward and backward also.
    2. Clicked on the video2 leaf of the tree. Video2.swf is getting played.
    I am not able to click on the seek bar to take the video pointer to the desired position. Also, I am not able to drag the pointer on the seek bar either forward or backward also.
    Play, Pause, Stop, Forward, Backward buttons on the skin works properly.
    3. If I again, click on the video1 leaf, point 1 observation is found.
    4. clicking agian, on video2 leaf, point 2 observation found.
    Please suggest.
    I tried with Loader also. But, nothing fruitful. Same result, as I am getting from SWF Loader.
    Please find the below used code.
    dp.xml
    <?xml version="1.0" encoding="utf-8"?>
    <root>
        <gallery label="All">
              <file label="video1" src="demo1_skin.swf" />
              <file label="video2" src="demo2_skin.swf" />
        </gallery>
    </root>
    Sample1.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white">
    <mx:Script>
        <![CDATA[
                  import mx.events.ListEvent;
                  private function tree_itemClick(event:ListEvent):void {
                        var t:Tree = event.currentTarget as Tree;
                        var dataObj:Object = event.itemRenderer.data;
                        swfLoader.load(null);
                        if (dataObj.hasOwnProperty("@src")) {
                            swfLoader.load(dataObj.@src);
              ]]>
    </mx:Script>
    <mx:XML id="dp" source="dp.xml" />
        <mx:HDividedBox width="100%" height="100%">
              <mx:Panel width="200" height="100%">
                  <mx:Tree id="tree" dataProvider="{dp}" labelField="@label"
                        showRoot="false" width="100%" height="100%" itemClick="tree_itemClick(event);" />
                  </mx:Panel>
                  <mx:Panel id="panel" width="100%" height="100%" backgroundColor="white">
                        <mx:SWFLoader id="swfLoader" width="100%" height="100%" />
                  </mx:Panel>
        </mx:HDividedBox>
    </mx:Application>
    log in the console
    [SWF] C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\Sample3.swf - 951,034 bytes after decompression
    Clicked on the video1 leaf of the tree
    [SWF] C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo1_skin.swf - 31,309 bytes after decompression
    this.getSWFVersion() = 7
    contentSWFFullPath = file://C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo1.swf
    [SWF] C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo1.swf - 323,414 bytes after decompression
    incrementWait = 1
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    decrementWait = 0
    Clicked on the video2 leaf of the tree
    [SWF] C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo2_skin.swf - 31,311 bytes after decompression
    [Unload SWF] C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo1.swf
    this.getSWFVersion() = 7
    contentSWFFullPath = file://C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo2.swf
    [SWF] C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo2.swf - 477,273 bytes after decompression
    incrementWait = 1
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    decrementWait = 0
    Clicked on the video1 leaf of the tree (Again)
    [SWF] C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo1_skin.swf - 31,309 bytes after decompression
    [Unload SWF] C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo2.swf
    this.getSWFVersion() = 7
    contentSWFFullPath = file://C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo1.swf
    [SWF] C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo1.swf - 323,414 bytes after decompression
    [Unload SWF] C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo2_skin.swf
    incrementWait = 1
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    decrementWait = 0
    Clicked on the video2 leaf of the tree (Again)
    [SWF] C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo2_skin.swf - 31,311 bytes after decompression
    [Unload SWF] C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo1.swf
    this.getSWFVersion() = 7
    contentSWFFullPath = file://C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo2.swf
    [SWF] C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo2.swf - 477,273 bytes after decompression
    incrementWait = 1
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    onLoad m_movie = null
    decrementWait = 0
    [Unload SWF] C:\Java_Flex_Practice\FlexPractice\Sample\bin-debug\demo1_skin.swf

    Try calling unloadAndStop() before loading a new swf.
    http://livedocs.adobe.com/flex/3/langref/mx/controls/SWFLoader.html#unloadAndStop()
    http://livedocs.adobe.com/flex/3/langref/flash/display/Loader.html#unloadAndStop()
    Note that unLoadAndStop()is FP10 only.

  • Can button in loaded SWF file unload or close the file ?

    Hi,
    I am loading 2 SWF files A and B, I have a button on each.
    When I press button on SWF A it loads SWF B. However I cannot get
    the button to close / unload the SWF A.
    Is this possible ?
    To Load I am using:
    Thanks,
    Paul

    No.I am using Loader since I dont need to pass one URL for fetching swf content.I need to get the displayobject from ByteArray which should be free from all the security issues.I heard that we cannot set 'securityDomain' property of loaderContext (using in Loader) in AIR.So please give a solution for getting bytes.

  • Load and unload the external swf file using AS3(for window, IOS and android)

    For the external swf file loading, I use this code
    load2.addEventListener(MouseEvent.MOUSE_DOWN, newvid);
    function newvid(event:MouseEvent) {
              trace("you clicked me");
              var loadit = new Loader();
              addChild(loadit);
        var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
        loadit.load(new URLRequest("scene02.swf"), _lc);
    its working great but I don’t know how to unload the loaded swf files (looking: unload one by one and unload all)
    in AS2 we have
    on (release) {
              loadMovieNum("scene2.swf", 1);
              unloadMovieNum(2);
              unloadMovieNum(3);
    but i need in AS3

    Now I use this code and this time I got these compiler errors
    package {
                    import flash.display.SimpleButton;
                    import flash.display.MovieClip;
                    import flash.events.MouseEvent;
                    //import flash.display.URLRequest;
                    //import flash.display.Loader;
                    import flash.events.Event;
                    import flash.system.ApplicationDomain;
                    import flash.net.URLRequest;
                    import flash.system.LoaderContext;            
                                    public class load1 extends SimpleButton {
                                                    var loadit:Loader;              
                                                    public function load1() {
                                                                    this.addEventListener(MouseEvent.MOUSE_DOWN, loadfile);
                                                    private function loadfile(event:MouseEvent):void {
                                                                    trace("you clicked me");
                                                                    loadit = new Loader();
                                                                    this.parent.addChild(loadit);
                                                                    var _lc:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);
                                                                    loadit.load(new URLRequest("s01.swf"), _lc);
                                                    private function unloadfile(event:MouseEvent):void {
                                                                    loadit.unloadAndStop();

Maybe you are looking for

  • Error while running the Financial Reporting in Workspace.

    Dear Folks I am facing an issue with FR Report in Workspace Hyperion Version : 11.1.1.3 on Windows 2003 64 bit. Problem Description: We are trying to run the FRS reports in workspace and getting an error in a window " Error Details : Error "<?xml ver

  • Workflow Activity "Lookup Value" returns An error occured while enumerating the filter using [//WorkflowData/customvalue]

    I want to generate an Accountname using EmployeeID, FirstName and LastName via a workflow. I'm using the Granfeldt Workflow Activity Library (https://fimactivitylibrary.codeplex.com/) I'm using the FIM Powershell Workflow Activity (https://fimpowersh

  • AirPort Extreme - Can't Ping or See Other LAN Computers

    I recently reset my AirPort Extreme in order to get it to work with a new cable modem (per Apple Care suggestion). The device had worked fine until I replaced my modem. The reset resolved the problem. However, I'm no longer able to ping (or utilize a

  • Keynote and PPS Files

    Can Keynote be configured so that .pps files automatically open as a slide show. I have set up a family member with an iMac, OS 10.5, and NeoOffice. She receives attachments as .pps files. Unfortunately, while NeoOffice can play .pps slide shows once

  • Error: Unable to find the WSDL port defined for Service

    Hi, I am facing below  error while invoking partner's WSDL: Oracle.Fabric.Common.FabricInvocationException: Unable to find WSDL port defined for the service. Can anybody guide me what could be the exact issue? * I am able to ping that host. Thanks Ri