# Preloader doesn't work

**URL:** <https://forum.kirupa.com/t/preloader-doesnt-work/289926>\
**Category:** flash\
**Created:** [June 7, 2009, 1:56pm UTC](https://forum.kirupa.com/t/preloader-doesnt-work/289926 "2009-06-07T13:56:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wampiro\_UHA](https://avatars.discourse-cdn.com/v4/letter/w/eb9ed0/32.png) [@Wampiro\_UHA](https://forum.kirupa.com/u/Wampiro_UHA)\
**Post date:** [June 7, 2009, 1:56pm UTC](https://forum.kirupa.com/t/preloader-doesnt-work/289926/1 "2009-06-07T13:56:44Z")

</div>

I’ve tried to create a preloader in frame 1 which shows a small animation while the site loades. But it doesn’t work as it actually loads the entire site before showing frame 1 which kinda takes the idea out of the preloader.

This is my code:  
[FONT=Courier New]stop();  
addEventListener(Event.ENTER\_FRAME, loading);  
function loading(event:Event) {  
var bytesloaded=stage.loaderInfo.bytesLoaded;  
var bytestotal=stage.loaderInfo.bytesTotal;  
if (bytesloaded\>10&&bytesloaded\>=bytestotal) {  
removeEventListener(Event.ENTER\_FRAME, loading);  
play();  
}  
}[/FONT]
