I don't know of any events.  You'll probably have to dispatch your own.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On Behalf 
Of Aaron Hardy
Sent: Monday, October 05, 2009 8:53 AM
To: flexcoders
Subject: [flexcoders] Detecting loader.close()



Hey all,

I have a Loader instance, I call the load() method, and then sometime 
thereafter but before the loading is complete I call the close() method.  Is 
there any sort of event I can watch that will tell me the loader has been 
closed?  As a very simple test, I tried the following but it never gets to the 
stop() method for any of the events.  In my real app I have a reference to the 
loader/loaderInfo in a different part of the app and need to know when the 
loader is closed.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute" 
creationComplete="go();">
    <mx:Script>
        <![CDATA[
            import flash.utils.setTimeout;

            protected var loader:Loader;

            protected function go():void
            {
                loader = new Loader();
                loader.load(new 
URLRequest('http://aaronhardy.com/wp-content/themes/thefunk/images/Mast.gif'));
                myUI.addChild(loader);
                loader.addEventListener(Event.DEACTIVATE, stop);
                loader.addEventListener(Event.CLOSE, stop);
                
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, stop);
                
loader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, stop);
                
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, stop);
                loader.contentLoaderInfo.addEventListener(Event.COMPLETE, stop);
                loader.contentLoaderInfo.addEventListener(Event.DEACTIVATE, 
stop);
                loader.contentLoaderInfo.addEventListener(Event.UNLOAD, stop);
                loader.close();
            }

            protected function stop(event:Event):void
            {
                trace(event);
            }
        ]]>
    </mx:Script>
    <mx:UIComponent id="myUI"/>
</mx:Application>

Thanks for any help!

Aaron

Reply via email to