Using a preloader in a separate AS file?
Hey folks,
I've appropriated a preloader I created previous where it existed on the main timeline. For my new project, I placed it in an external AS file, but something's off. I keep getting this error message, referencing line 16 in my line of code:
"1046: Type was not found or was not a compile-time constant: Event."
The code is below:
package {
import flash.display.MovieClip;
import flash.events.Event.ENTER_FRAME;
import flash.events.MouseEvent;
import MainNav;
import Gallery;
import MP3Player;
public class ZDSite extends MovieClip{
stop();
private var total:Number = stage.loaderInfo.bytesTotal;
private var loaded:Number = stage.loaderInfo.bytesLoaded;
addEventListener(Event.ENTER_FRAME, loading);
private function loading(event:Event):void {
//add in load bar here later: Bar_mc.scaleX = loaded/total;
//add in load text box here late: txtLoaded.text = Math.floor((loaded/total)*100)+ "%";
//add more load stuff here later
if (total == loaded) {
play();
removeEventListener(Event.ENTER_FRAME, loading);
//add in function to check if current frame = 60 and stop there
//add in MainNav, Gallery, and MP3Player to bring objects to stage here
}
}
}
public class MainNav extends MovieClip {
//insert Main Nav Stuff here
}
public class Gallery extends MovieClip {
//insert Gallery stuff here
}
public class MP3PLayer extends MovieClip {
//insert MP3 Player stuff here
}
}
Any insight would be appreciated. Thanks!