Hello!
I have a swf "main.swf" with four button that loads four external swf.
When I open "main.swf" load the first swf "home.swf"
import com.greensock.*;
import com.greensock.loading.SWFLoader;
import com.greensock.events.LoaderEvent;
import flash.events.MouseEvent;
var loader:SWFLoader = new SWFLoader("home.swf",{onInit:initHandler, onProgress:progressHandler, onComplete:completeHandler, container:this});
var swf = new Array(home,about,contact,works);
for (var i:int=0; i<swf.length; i++) {
swf[i].addEventListener(MouseEvent.CLICK, openSwf);
}
function openSwf(e:MouseEvent): void{
var newURL:String = e.target.name + ".swf";
loader.url = newURL;
loader.load(true); // reload SWFLoader and flush/unload old content
}
function initHandler(event:LoaderEvent):void {
//fade the swf in as soon as it inits
TweenLite.from(event.target.content, 1, {alpha:0});
}
function progressHandler(event:LoaderEvent):void {
progress_mc.progressBar_mc.scaleX = event.target.progress;
trace("progress: " + event.target.progress);
}
function completeHandler(event:LoaderEvent):void {
trace(event.target + " is complete!");
TweenLite.to(progress_mc.progressBar_mc, 1, {alpha:0});
}
//load the first swf
loader.load();
I would like to write a code to preload my site and at the same time the first content (Home.swf) in a different total progress bar for for example "total_bar". I suppose that should be used a queue:LoaderMax and append all I want to load...is that right?
But I should do it on main.swf or should I create another swf file (for example index.swf) that loads the main.swf and home.swf?
Thanks for your help and sorry for my english!