I'm working in AS3, Flash AIR 3.2 for iOS SDK. I'm trying to run part of the program only after myLoader
finishes loading an image. I have a myTimer.start();
which runs inside myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
.
What seems to be the problem at the moment is that the program is ignoring the 1000ms. The program is running after myLoader
is finished at the moment, but it just seems to be doing its own thing in terms of the delay.
EDIT: Being more precise here... The program seems to be ignoring the Timer delay. Even if Timer is set to 100000ms. It seems to be running the rest of the program right after the image is loaded.
EDIT: I still had my methods running inside my Main() as well as the timerListener() in the code. Thought I commented them out. Whoops!
var myTimer:Timer = new Timer(1000);
public function Main()
{
init();
displayImage();
myTimer.addEventListener(TimerEvent.TIMER, timerListener);
myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, timerDone);
}
public function displayImage():void {
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
myLoader.load(fileRequest);
}
public function onLoaderComplete(e:Event) {
//start Timer event here
myTimer.start();
}
public function timerListener (e:TimerEvent):void{
trace("Timer is Triggered");
myTimer.stop();
aMethod();
anotherMethod();
moreMethods();
}