# Preloader problem

**URL:** https://forum.kirupa.com/t/preloader-problem/295398
**Category:** Uncategorized
**Created:** [August 29, 2009, 9:47am UTC](https://forum.kirupa.com/t/preloader-problem/295398 "2009-08-29T09:47:43Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![vigneshbhim](https://avatars.discourse-cdn.com/v4/letter/v/f475e1/32.png) [@vigneshbhim](https://forum.kirupa.com/u/vigneshbhim)
#### Post date: [August 29, 2009, 9:47am UTC](https://forum.kirupa.com/t/preloader-problem/295398/1 "2009-08-29T09:47:43Z")

</div>

Hi.  
I’m a little new to as3 but find it alot of fun and challenging. I’m currently creating a website for someone I know in flash (cs4).  
I ve completed the entire front end of the site but to give it a polished look I started to add a preloader.

I’m adding the preloader on the first frame of the .fla file and the actual website starts from frame 5. The site plays fine by itself without the preloader. when i add the preloader set of codes i get the following error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.  
at web\_as3\_fla::MainTimeline/frame5()  
at flash.display::Sprite/constructChildren()  
at flash.display::Sprite()  
at flash.display::MovieClip()  
at web\_as3\_fla::clap\_mc\_28()

I understand that now the problem is probably with the main movie but I fail to understand then y it played properly without the preloader! ;(

this is my preloader code:

stop();  
this.addEventListener(Event.ENTER\_FRAME, loading);  
function loading(e:Event):void{  
var total:Number = this.stage.loaderInfo.bytesTotal;  
var loaded:Number = this.stage.loaderInfo.bytesLoaded;  
loadBar.scaleX = loaded/total;  
loadText.text = Math.floor((loaded/total)\*100)+ “%”;  
if (total == loaded){  
play();  
this.removeEventListener(Event.ENTER\_FRAME, loading);  
}  
}

Now how to I find what is wrong and then how do I correct it?  
Please help!  
Thanks 🙂
