//provide a list with all your movies to load and the levels to load into
moviearray = new Array("Flash/PHA-HCP/Unit_1/Chapter_1/data/swf/slide1.swf",2,"Flash/PHA-HCP/Unit_1/Chapter_1/data/swf/slide3.swf",2670,"Flash/PHA-HCP/Unit_1/Chapter_1/data/swf/slide4.swf",4171,"Flash/PHA-HCP/Unit_1/Chapter_1/data/swf/slide5.swf",5010,"Flash/PHA-HCP/Unit_1/Chapter_1/data/swf/slide6.swf",6150);
//set the index of the first movie to load
actMovieIdx = 0;
// get the next moviename and level
moviename = moviearray[actMovieIdx++];
movielevel = moviearray[actMovieIdx++];
// load the given movie
loadMovieNum(moviename, movielevel);
//get the actual loaded bytes
actBytes = eval("_level" add movielevel).getBytesLoaded() || 0;
// get the total bytes to load
totBytes = eval("_level" add movielevel).getBytesTotal() || 100;
// calculate the percentage loaded
percent = Math.round(actBytes * 100 / totBytes);
if( totBytes - actBytes > 10){//more bytes available, keep on loading
gotoAndPlay(3);
} else if(actMovieIdx < moviearray.length){//if we got more movies to load
gotoAndPlay(2);
} // else go to frame 5
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
function startLoad()
{
var mLoader:Loader = new Loader();
var mRequest:URLRequest = new URLRequest("Flash/PHA-HCP/Unit_1/Chapter_1/data/swf/slide1.swf");
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
mLoader.load(mRequest);
}
function onCompleteHandler(loadEvent:Event)
{
addChild(loadEvent.currentTarget.content);
}
function onProgressHandler(mProgress:ProgressEvent)
{
var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
trace(percent);
}
startLoad();
stop();
var fileNames : Array = [ "Flash/PHA-HCP/Unit_1/Chapter_1/data/swf/slide1.swf",
"Flash/PHA-HCP/Unit_1/Chapter_1/data/swf/slide3.swf",
"Flash/PHA-HCP/Unit_1/Chapter_1/data/swf/slide4.swf",
"Flash/PHA-HCP/Unit_1/Chapter_1/data/swf/slide5.swf",
"Flash/PHA-HCP/Unit_1/Chapter_1/data/swf/slide6.swf",
];
var loaders : Array;
var loadedCount : uint;
start();
function start() : void
{
loaders = new Array();
loadedCount = 0;
for (var i : uint = 0 ; i < fileNames.length ; i++)
{
var loaderContext:LoaderContext=new LoaderContext();
loaderContext.checkPolicyFile=true;
loaders[i] = new Loader();
loaders[i].contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
loaders[i].load(new URLRequest(fileNames[i]), loaderContext);
}
}
function onLoaderComplete(e:Event) :void
{
trace("hello");
var total:Number = this.stage.loaderInfo.bytesTotal;
var loaded:Number = this.stage.loaderInfo.bytesLoaded;
//bar_mc.scaleX = loaded/total * 100;
//loader_txt.text = Math.floor((loaded/total)*100)+ "%";
e.currentTarget.removeEventListener(Event.COMPLETE, onLoaderComplete);
if (loadedCount++ == fileNames.length);
{
trace(loadedCount);
trace(fileNames.length);
trace('Attempting to Play');
//play();
}
}