Hi Guys,

I am having a BIG problem with loading and unloading Flash CS3 
animation ?

You can download the two swf animations...

Good.swf is good and can be unload
while Bad.swf can not be unloaded

http://www.helihobby.com/html/TestSWFs.zip

Is there something I am missing ?
Is this a Flex / AIR bug ?
Do I need to implement something in Flash CS3 animation swf for this 
to work ?

Thanks alot for the time,

Sean.

Here is a sample code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
layout="absolute"
        creationComplete="onInit()">
        <mx:Script>
                <![CDATA[
                        import mx.modules.ModuleLoader;
                        import mx.core.UIComponent;
                        import mx.controls.SWFLoader;
                        
                        private var m_ui:UIComponent
                        private var m_loader:Loader;
                        private var m_timer:Timer = new Timer(1 * 60 
* 1000);
                        
                        private function onInit():void
                        {
                                m_ui =  new UIComponent();
                                m_ui.width=400;
                                m_ui.height=400;
                                addChild(m_ui);
                                m_timer.addEventListener
(TimerEvent.TIMER, onTimer);
                                m_timer.start();
                                onTimer(null);
                        }
                        
                        private function onTimer
(event:TimerEvent):void
                        {
                                if (m_loader!=null)
                                {
                                        m_ui.visible = false;
                                        return;
                                        
                                        m_loader.unload();
                                        m_ui.removeChild(m_loader);
                                        m_ui.validateNow();
                                        m_loader = null;
                                }
                                
                                m_loader = new Loader();
                                var request:URLRequest = new 
URLRequest("Good.swf");
                                m_loader.load(request);
                                m_ui.addChild(m_loader);
                                m_ui.validateNow();
                                System.gc();
                        }
                ]]>
        </mx:Script>
</mx:Application>

Reply via email to