I´m loading swf:s into my main movie to an empty MC (holder) and would like to have a preloader in my mainmovie to handle the preloading of all swf:s that I load. Using this code in my mainmovie.
[AS]holder.onEnterFrame = function() {
this.bytes_loaded = Math.round(getBytesLoaded());
this.bytes_total = Math.round(getBytesTotal());
this.getPercent = bytes_loaded/bytes_total;
loadBarH._width = (this.getPercent*100)1.5;
// give textbox an instance name of “loadTextH” (no quotes)
loadTextH.text = Math.round(this.getPercent100)+"%";[/AS]
I get a NaN in my textbox? I don´t get why the Math.round should give numbers to the loadTextH textbox.
Sorry to bug you time and time again but I can´t figure this one out. All my code looked ok and your code look great but I can´t get it to work…very frustrating.
Also try using this.getBytesLoaded() and this.getBytesTotal() , it doesn’t hurt to try it, and it’s good coding practice (which im not showing much of today…lol)
If you are testing on your computer it will always be at 100. Not event CTRL+Enter+Enter (Show streaming) can work for dynamically loaded in content, that always loads like lightning. You will have to test it on a server to actually test it (making sure not to cache your images or it will load quick anyway… you can do a search for no cache code on the forum).
And if this doesn’t work theres always that link I posted before. I know for a fact that code works, I use it all the time :sigh:
Err me again and another sleepless night but I can´t for the life of me figure this one out please have a look at the fla and help mie out with what is wrong?
Hi again lost sorry to bug you with this again but I can´t get it to work?!!! After 2 weeks of this I´m pretty messed up
This code goes into the MC that the swf:s are loaded into?
[AS]holder.onEnterFrame = function() {
this.bytes_loaded = Math.round(this.getBytesLoaded());
this.bytes_total = Math.round(this.getBytesTotal());
this.getPercent = this.bytes_loaded/this.bytes_total;
_root.loadBar._width = (this.getPercent*100)1.5;
// give textbox an instance name of “loadText” (no quotes)
_root.loadText.text = Math.round(this.getPercent100)+"%";
}
[/AS]
And is it the instance name of the MC or the name that should be adressed ( instance name holder and name mc_holder tried both but no go).
attaching the fla so you may se my problem.
Others feel free to have a whack at this as well have been bugin´alot of people with this and have gotten a sollution from Claudio but that didn´t fit with my “build” of the fla.