hey there.
i know it's possible to check how much of a loaded swf is loaded, but how would i do the same thing with a jpg? (i've not done it with a swf, but i know it is possible)
any suggestions?
| SitePoint Sponsor |

hey there.
i know it's possible to check how much of a loaded swf is loaded, but how would i do the same thing with a jpg? (i've not done it with a swf, but i know it is possible)
any suggestions?
using loadMovie, loadMovieNum, or loadVariables, loadVariablesNum you can use onData.
Code:myMovieClip.onData = function () { trace (myMovieClip.getBytesLoaded()); };![]()
hth.





BOOMEr did you test that? In my experience MX has a hard time applying the onData handler to loaded jpgs. I cannot get it to work.
Please don't PM me with questions.
Use the forums, that is what they are here for.
Try this:
Code:MovieClip.prototype.loadjpg = function(picName) { this.createEmptyMovieClip("holder", 1); this.holder.loadMovie(picName); this.activateChecking(); } MovieClip.prototype.activateChecking = function () { this.onEnterFrame = function() { if (this.holder.getBytesLoaded() > 1 && this.holder.getBytesLoaded() >= this.holder.getBytesTotal()) { this.stopChecking(); this.onComplete(); } } } MovieClip.prototype.stopChecking = function() { this.onEnterFrame = null; } // function to execute when loading is done function rotateMe() { // this is whatever you want to have happen // on load (could be just play(), eg) loadTarget.onEnterFrame = function() { this._rotation += 5; } } // only need this if creating from scratch this.createEmptyMovieClip("loadTarget", 1); loadTarget.onComplete = rotateMe; loadTarget.loadjpg("pic.jpg");





Yes that works, but come on, don't you feel like macromedia should fix the onData event handler to recognize loaded jpgs? I sure do![]()
Please don't PM me with questions.
Use the forums, that is what they are here for.
I wasn't aware of the problem until I started testing myself. Sorry for the mis-information. Btw, that prototypes aren't mine they are helen triolos of http://actionscript-toolbox.com/
Bookmarks