Search Tutorials
What makes this little movie work right is this little piece of code:
var total = _root.getBytesTotal();
var loaded = _root.getBytesLoaded();
var perc = (loaded / total) * 100;
percent = perc + "%";
setProperty("progress",_xscale,perc);
if (loaded == total) {
percent = "complete";
gotoAndStop("Done");
}
Personally, I would say it's pretty much all self-explanatory. Of course, I did write it, so.... All it does is finds the total size (in bytes) of the root movie, finds the amount of bytes loaded into memory, and finds a percentage. That percentage is displayed below the bar while the bar is continually changing size, according to the percentage loaded. When the movie is entirely loaded, the script tells the movie to jump to the frame labelled "Done" (frame 3 in the included movie). However, if it's not done, the script doesn't do anything. Why is that, you ask? The next frame has the following action, which solves the problem:
gotoAndStop("nope");
That action just creates a loop until the script in the first frame (frame "nope") tells the movie that the movie is entirely loaded! Clear as mud? Well, if you have any questions, just e-mail me at webmaster@jvcpp.f2s.com. It shouldn't take me too long to reply :)
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|