Preloader in CS3

if (newSlides.currentLoadingImage<1) {
//loadingTxt.text = String("Loading “+(newSlides.currentLoadingImage+1)+” of “+Math.floor(event.bytesLoaded/1024)+ " kilobytes have loaded from “+Math.floor(event.bytesTotal/1024)+” total kilobytes”);
addEventListener(Event.ENTER_FRAME, loading);
function loading(event:Event) {
var bytestotal = event.bytesTotal;
var bytesloaded = event.bytesLoaded;
var sclbar = Math.round(bytesloaded*100/bytestotal);
custom_animation.gotoAndPlay(sclbar);
if (bytesloaded >= bytestotal) {
removeEventListener(Event.ENTER_FRAME, loading);
removeChild(custom_animation);
}

Hello,

I am trying to load use the code in the second line to generate animation for a bar loader that I have created in the _root of the movie with instance name “custom_animation”.

I keep getting the following errors:

1119: Access of possibly undefined property bytesTotal through a reference with static type flash.events:Event. (source: var bytestotal = event.bytesTotal;)
1119: Access of possibly undefined property bytesLoaded through a reference with static type flash.events:Event. (source: var bytesloaded = event.bytesLoaded;)

Can someone figure out what is wrong here?

Thanks,
Ian