# Starting a Preloader from a TimerEvent

**URL:** <https://forum.kirupa.com/t/starting-a-preloader-from-a-timerevent/297552>\
**Category:** flash\
**Created:** [October 5, 2009, 9:35am UTC](https://forum.kirupa.com/t/starting-a-preloader-from-a-timerevent/297552 "2009-10-05T09:35:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zanelyon](https://avatars.discourse-cdn.com/v4/letter/z/e0b2c6/32.png) [@zanelyon](https://forum.kirupa.com/u/zanelyon)\
**Post date:** [October 5, 2009, 9:35am UTC](https://forum.kirupa.com/t/starting-a-preloader-from-a-timerevent/297552/1 "2009-10-05T09:35:33Z")

</div>

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(percent_100) + “%”);  
load\_symbol.progress\_txt.text = Math.ceil(percent_100) + “%”;  
}

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]
