# Preloader problem!

**URL:** <https://forum.kirupa.com/t/preloader-problem/264003>\
**Category:** Uncategorized\
**Created:** [June 21, 2008, 9:54pm UTC](https://forum.kirupa.com/t/preloader-problem/264003 "2008-06-21T21:54:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anix](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anix](https://forum.kirupa.com/u/anix)\
**Post date:** [June 21, 2008, 9:54pm UTC](https://forum.kirupa.com/t/preloader-problem/264003/1 "2008-06-21T21:54:27Z")

</div>

I am currently designing a new preloader for my site and as this is the first preloader i have made in AS3 i am having issues. I have done all the code as it should be i think, i have a movieclip in my library with the linkage property of “preLoader” and within tht movieclip there iis a dynamic text box with an instance name of “percentText”. but when i try to run the code i get 3 errors as below:

1119: Access of possibly undefined property bytesLoaded through a reference with static type flash.events:Event.

1119: Access of possibly undefined property bytesLoaded through a reference with static type flash.events:Event.

The lines of code that these 2 errors refer too are highlighted in red in my code below.Thanks

```auto
var newRequest:URLRequest = new URLRequest("portfolio5.swf");
var newLoader:Loader = new Loader();

newLoader.load (newRequest);

newLoader.contentLoaderInfo.addEventListener(Event.OPEN, showPreloader);
newLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);
newLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, showContent);

var newPreloader:preLoader = new preLoader();

function showPreloader(event:Event):void
{
    
    addChild(newPreloader);
    
    newPreloader.x = stage.stageWidth / 2;
    newPreloader.y = stage.stageHeight / 2;
        
}

function showProgress(event:Event):void
{
    
    var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
    newPreloader.percentText.text = Math.round(percentLoaded * 100) + "%";
    
}

function showContent (event:Event):void
{
    
    removeChild(newPreloader);
    addChild(newLoader);
    
}

```

---

<div class="post-metadata">

**Author:** ![anix](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anix](https://forum.kirupa.com/u/anix)\
**Post date:** [June 21, 2008, 9:56pm UTC](https://forum.kirupa.com/t/preloader-problem/264003/2 "2008-06-21T21:56:03Z")

</div>

the error occurs on line “var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;”

---

<div class="post-metadata">

**Author:** ![TronicVolta](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@TronicVolta](https://forum.kirupa.com/u/TronicVolta)\
**Post date:** [June 21, 2008, 10:18pm UTC](https://forum.kirupa.com/t/preloader-problem/264003/3 "2008-06-21T22:18:49Z")

</div>

What happens if you were to change the word Event to ProgressEvent?

```auto
function showProgress(event:ProgressEvent):void

```

---

<div class="post-metadata">

**Author:** ![anix](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anix](https://forum.kirupa.com/u/anix)\
**Post date:** [June 22, 2008, 1:33pm UTC](https://forum.kirupa.com/t/preloader-problem/264003/4 "2008-06-22T13:33:19Z")

</div>

Thanks alot m8 i didnt even notice that lol! its all sorted now lol! thanks
