Groups | Blog | Home
all groups > flash actionscript > june 2005 >

flash actionscript : Detecting the Download Progress of External Movies


mjpolizz
6/9/2005 8:25:25 PM
I am working in Flash MX 2004 and I'm using the new MovieClipLoader class to
load an external Flash Movie "bigMovie.swf" into another Flash movie. The
Flash movie itself works fine, I just don't understand the use of one of the
event handlers, onLoadProgress, which is highlighted below. My question deals
with the parameters that are specified within the onLoadProgress anonymous
function. The parameters of the function are variables, which to me appear out
of no where, and have not been defined. Please help in explaining this. Thanks.





mcLoader_mcl = new MovieClipLoader;
loadListener = new Object();
mcLoader_mcl.addListener(loadListener);

mcLoader_mcl.loadClip("http://www.russellchun.com/bigMovie.swf",
_root.loader_mc);

loadListener.onLoadStart = function(){
loader_mc.stop();
};



//---------------------WHY DOES THIS
WORK??????---------------------------------
loadListener.onLoadProgress = function(mc, loadedBytes, totalBytes){
preloaded = Math.floor(loadedBytes/totalBytes*100);
loaderText_txt.text = preloaded + "% loaded";
bar_mc._xscale = preloaded;
};

//------------------------------------------------------------------------------

loadListener.onLoadComplete = function(){
loaderText_txt._visible = false;
bar_mc._visible = false;
loader_mc.play();
};TextonLoadProgress
Rothrock
6/9/2005 9:01:59 PM
The onLoadProgress event returns an object that object happens to have those
three properties. It may have others, I don't know. There are quite a few
events which actually return objects with interesting data.
Sudipto
6/10/2005 12:00:00 AM
These parameters of onLoadProgress are used to display the usr the
downloaded percentage of the movie .
The % is calulated based upon no of Bytes loaded ,that is loadedBytes that
have been transferred and totalBytes that represent the total bytes of file
size.


[quoted text, click to view]
//--------------------------------------------------------------------------
----
[quoted text, click to view]

AddThis Social Bookmark Button