all groups > flash actionscript > november 2005 >
You're in the

flash actionscript

group:

A better loading Display.


A better loading Display. andrewbyles
11/17/2005 9:35:08 PM
flash actionscript:
I'm using the below code to preload, two .swf when my web page loads. It loads
the first .swf "hjem.swf" and plays it while the second .swf continues to load
"bgImage.swf". The dynamic text displays, the load progress of both movies as
one percentage.

My question is, is it possible to define in the "mclListener" seperate
percentages and names for each .swf?

eg the text would display say "Loading hjem" and once it was completely loaded
would change to "Loading Background Image".
//
//

// - - - preloader - - -
var my_mcl:MovieClipLoader = new MovieClipLoader();
//
var mclListener:Object = new Object();
mclListener.onLoadError = function(target_mc:MovieClip, errorCode:String,
status:Number) {
loadStatus.text = "Error Loading Image";
};
mclListener.onLoadProgress = function(target_mc:MovieClip,
numBytesLoaded:Number, numBytesTotal:Number):Void {
var numPercentLoaded:Number = Math.round(numBytesLoaded/numBytesTotal*100);
loadStatus.text = "Load Progress: "+numPercentLoaded+"% loaded";
};
mclListener.onLoadComplete = function(target_mc:MovieClip, status:Number):Void
{
loadStatus.text = "";
var contTween:Tween = new Tween(myTarget, "_x", tween, -1000, 34, .5, true);
};
//
my_mcl.addListener(mclListener);
// - - - LoadMovie - - -
my_mcl.loadClip("hjem.swf", myTarget);
my_mcl.loadClip("bgImage.swf", bgTarget);
//
Re: A better loading Display. LuigiL
11/18/2005 8:26:59 AM
You can try something like:
mclListener.onLoadProgress = function(target_mc:MovieClip,
numBytesLoaded:Number, numBytesTotal:Number):Void {
var numPercentLoaded:Number = Math.round(numBytesLoaded/numBytesTotal*100);
if(target_mc._name=="myTarget"){
loadStatus.text = "Load Progress on hjem: "+numPercentLoaded+"% loaded";
} else if(target_mc._name=="bgTarget") {
loadStatus.text = "Load Progress on background: "+numPercentLoaded+"%
loaded";
}
};
Re: A better loading Display. andrewbyles
11/18/2005 10:29:36 AM
AddThis Social Bookmark Button