I have a pre loader for my animation that uses this code:
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;
//bar_mc.scaleX = loaded/total;
Load_Amount.text = "[" + Math.floor((loaded/total)*100)+ "%]";
if (total == loaded){
Load_Amount.text = "[CLICK]";
play();
this.removeEventListener(Event.ENTER_FRAME, loading);
}
}
and :
Exit_Loader.addEventListener(
MouseEvent.MOUSE_UP,
function(evt:MouseEvent):void {
play();
}
);
this works fine, until i try to add a class to the .fla, then it gives me errors:
1046: Type was not found or was not a compile-time constant: Event. for
function loading(e:Event):void{
why is this happening? I set the document class to ‘Main’ and i have ‘Main.as’ in the same directory as my .fla , removing the document class removes the error…