Hey guys,
Im using the AS3 preloader code from kirupa’s tutorial and I am having a problem. The preloader works fine, but the movie I am loading has a animation to play (like an intro). Here is the problem:
When the preloader is loading, somehow the movie plays before it is fully loaded… How can I code my flash movie to wait for the swf to fully load to play???
here is my code:
var imageLoader:Loader;
function loadImage(url:String):void {
// Show Preloader
preloader.visible = true;
// Set properties on my Loader object
imageLoader = new Loader();
imageLoader.load(new URLRequest(url));
imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
}
loadImage("swf/main.swf");
function imageLoaded(e:Event):void {
// Load Image
mainArea.addChild(imageLoader);
// Hide Preloader
preloader.visible = false;
load_mc.visible = false;
}
function imageLoading(e:ProgressEvent):void {
// Get current download progress
var loaded:Number = e.bytesLoaded / e.bytesTotal;
// Send progress info to "preloader" movie clip
preloader.SetProgress(loaded);
}