Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flash MX 2004: Getting a listener to talk

Status
Not open for further replies.

mattquantic

Programmer
Mar 28, 2004
196
GB

Hi I am playing with this code (from help) it works great, but I don't understand how to trace the load progress into the debug window from the listeners... Am I being really dumb? - Im just trying to trace the progress of the jpg loading...

Code:
var my_mcl = new MovieClipLoader();
myListener = new Object();

myListener.onLoadStart = function (target_mc){
	var loadProgress = my_mcl.getProgress(target_mc);
	myTrace(loadProgress.bytesLoaded + " = bytes loaded at start");
	myTrace(loadProgress.bytesTotal + " = bytes total at start");
}

myListener.onLoadProgress = function (target_mc, loadedBytes, totalBytes){
	myTrace(loadedBytes + " = bytes loaded at progress callback " );
	myTrace(totalBytes + " = bytes total at progress callback \n");
}

myListener.onLoadComplete = function (target_mc){
	var loadProgress = my_mcl.getProgress(target_mc);
	myTrace(loadProgress.bytesLoaded + " = bytes loaded at end" );
	myTrace(loadProgress.bytesTotal + " = bytes total at end=");
}

myListener.onLoadInit = function (target_mc){	
	target_mc._width = 341;
	target_mc._width = 279;
} 
myListener.onLoadError = function (target_mc, errorCode){
	myTrace ("ERROR CODE = " + errorCode);
	myTrace ("Your load failed on movie clip = " + target_mc + "\n");
} 

my_mcl.addListener(myListener);
my_mcl.loadClip("s2k.jpg","_root.holder_mc");
my_mcl.onLoadProgress();


M@?
 
you can't trace the progress in the authoring environmet. this is because the swf is not being downloaded, and thus, there is no download progress. (literally, the progress event fires when ever data is written to the disk. in the case of doing test movie, the whole swf is already written to the disk before the program runs)

Philip Keiter
Senior Flash Software Developer
Sphyrras
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top