Before I start my preloader animation, I want to play a quick animation. I was hoping to use a TimerEvent to delay the preloader from starting until the animation was over, but nothing’s happening.
I cobbled this together from other preloader tutorials, and since I’m not sure I understand how it all works, I shouldn’t be too surprised that my hybrid failed.
Here’s what I’ve got:
[COLOR=Blue]var delay_timer:Timer = new Timer(480, 1);
delay_timer.addEventListener(TimerEvent.TIMER, play_loader);
delay_timer.start();
function play_loader(e:TimerEvent)
{
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, check_progress);
this.loaderInfo.addEventListener(Event.COMPLETE, check_complete);
}
function check_progress(e:ProgressEvent):void
{
trace(“in check_progress”);
var percent:Number = e.bytesLoaded / e.bytesTotal;
trace(Math.ceil(percent100) + “%”);
load_symbol.progress_txt.text = Math.ceil(percent100) + “%”;
}
function check_complete(e:Event):void
{
trace(“in check_complete”);
this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, check_progress);
this.loaderInfo.removeEventListener(Event.COMPLETE, check_complete);
}[/COLOR]
[COLOR=Black]I don’t register either trace statement, but if I move[/COLOR] [COLOR=Blue][COLOR=Black]this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, check_progress);[/COLOR] [COLOR=Black]out of the timer event function, then I get the trace statement just fine.
Any help on where I’m going wrong would be appreciated.
Thanks!
[/COLOR][/COLOR]