onLoadProgress() question 2004-03-02 - By Andreas Weber
Back The new movieClipLoader is imo a great tool - however, it's still very poorly documented.
2 things: - you cannot test the onLoadProgress when you load the file locally. The load happens so fast that the event never fires. You have to upload your files to the webserver and test it in the Browser (to re-test empty the browser cache)
- due to a pretty unlucky naming decision on the part of MM everyone will try the onLoadComplete to access the properties of the loaded file. However it's the onLoadInit event which must be used: the file must be completely loaded and initialized to access the properties.
I think that you onLoadProgress function should work, but I would suggest you change it to something like:
myListener.onLoadProgress = function(target_mc, loadedBytes, totalBytes){ status_txt.text += 'loadedBytes '+ loadedBytes +' - totalBytes '+totalBytes+'\n'; }
Find below some tested code.
-- ---- ------ Andreas Weber motiondraw.com
// on stage: a big dynamic textfield, instande name out_txt
fileToLoad = 'BlueHills.jpg';
myLoader = new MovieClipLoader();
myListener = new Object();
this.createEmptyMovieClip('holder_mc',1); myLoader.loadClip(fileToLoad, holder_mc);
myListener.onLoadProgress = function(target_mc, loadedBytes, totalBytes){ out_txt.text += 'loadedBytes '+ loadedBytes +' - totalBytes '+totalBytes+'\n'; } myListener.onLoadInit = function(){ out_txt.text += 'file completely loaded and initialized. Now all properties can be accessed \n'; holder_mc._xscale = holder_mc._yscale = 20; } myLoader.addListener(myListener);
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Supported by Fig Leaf Software -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ Lower Prices for Certified Training! Check out new lower prices for Certified Macromedia Training from Fig Leaf Software. Expand your skill set with courses in ColdFusion, Flash, Rich Internet Applications and .NET in the new year. Fig Leaf Software provides the highest caliber instruction at our training centers in Washington D.C., Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location.
Get the details at http://training.figleaf.com/ -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe, e-mail: flashnewbie-unsubscribe@(protected) For additional commands, e-mail: flashnewbie-help@(protected)
|
|