# as2 preloader glitch

**URL:** <https://forum.kirupa.com/t/as2-preloader-glitch/317383>\
**Category:** flash\
**Created:** [December 18, 2010, 1:21pm UTC](https://forum.kirupa.com/t/as2-preloader-glitch/317383 "2010-12-18T13:21:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![simondp](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@simondp](https://forum.kirupa.com/u/simondp)\
**Post date:** [December 18, 2010, 1:21pm UTC](https://forum.kirupa.com/t/as2-preloader-glitch/317383/1 "2010-12-18T13:21:58Z")

</div>

Hi all,

I’ve just built a site using mx2004 and as2, that’s around 6MB in size. I stuck a very simple preloader on using the following code in frame 1:

\<as\>  
stop ();

var loaderInterval = setInterval (loading,10);  
function loading () {  
percent\_txt.text = Math.round (getBytesLoaded ()/ getBytesTotal ()\*100)+"%";  
if (getBytesLoaded () \>= getBytesTotal () ){  
gotoAndPlay (“intro”);  
percent\_txt.\_visible = false;  
clearInterval (loaderInterval);  
}  
}  
\</as\>

on a preloader layer, I have nothing but a dynamic Text field, called percent\_txt.

The thing is, it won’t show anything until around 90% of the way through the load. when magically the preloader text appears for the last second (starting at 90%). I’ve tried it on another movie and it works exactly as it should. Any ideas why? What am I doing wrong!!! I’m beginning to pull my hair out over this. I’m simulating a download speed of 1MB/s and also uploaded the partial movie to a server. No good.

Any ideas would be gratefully received.  
Cheers, Simon

ps I’m a complete noob, and if it wasn’t for the likes of you guys I’d still be trying to work out why the hell I tried flash in the first place, so keep up the fantastic work!
