I have a preloader in my flex application:
public class Preloader extends DownloadProgressBar
{
private var _preloader:PreloaderAnimation;
public function Preloader()
{
super();
_preloader = new PreloaderAnimation;
addChild(_preloader);
}
public override function set preloader(preloader:Sprite):void
{
preloader.addEventListener(ProgressEvent.PROGRESS , onSWFDownloadProgress );
preloader.addEventListener(Event.COMPLETE , onSWFDownloadComplete );
preloader.addEventListener(FlexEvent.INIT_PROGRESS , onFlexInitProgress );
preloader.addEventListener(FlexEvent.INIT_COMPLETE , onFlexInitComplete );
}
.........
private function onFlexInitComplete( event:FlexEvent ):void
{
dispatchEvent(new Event(Event.COMPLETE));
}
}
When the Flex Initialize is complete the preloader dispatches an Event.COMPLETE. But I want to be able to listen to the event in my flex app and do stuff when it dispatches. When it dispatches the preloader removes itself that's why its crucial. Any idea on how I could listen from my flex app?
Regards Adlertz