Below you’ll see the code for the preloader I’ve been using for the past few weeks. It works fine if I want to have two separate SWFs (the main SWF, and the preloader SWF.)
Unfortunately, for the current project I am working on, it is necessary for the preloader to be part of the main file. I would like to modify the code below a bit, so that I can place it on frame 1, which would then advance to frame 2 when the SWF is fully loaded.
Any help would be greatly appreciated.
var req:URLRequest = new URLRequest("tour.swf");
var loader:Loader = new Loader();
loader.load(req);
addChild(loader);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, checkProgress);
function checkProgress(p:ProgressEvent):void {
var percent:int = (p.currentTarget.bytesLoaded / p.currentTarget.bytesTotal) * 100;
mLoadBar.scaleX = percent;
}