First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Cathode | Website: http://www.hellomonkey.com

Setting up the actions

Bruce Lee ain't got nothin' on this

In the second frame of the control layer, we want this action:

loadedkbytes=Math.ceil (loadedbytes/1000);
if (loadedbytes == totalbytes) {
	nextScene ();
frame = int(loadedbytes/(totalbytes/100));
tellTarget (_root.loader) {
	gotoAndStop (_root.frame);

Explanation Time

First, we set up our variables, using getBytesLoaded() and getBytesTotal(). Note that loadedkbytes and totalkbytes use Math.ceil(), which rounds the results up to the nearest integer. When looking at KB, no one cares about the leftover fractions! (well maybe some people do, I don't know.)

Next we use an if statement to see whether or not the movie is loaded. I use the "==" operator here, because it checks for true or false. If it's true, we just go to the next frame and continue on with our movie. If it's false, we continue on down the script.

The next part gives us our percentage value, which also is the frame number we want our loader to go to. After figuring what percentage we are at in the loading process, we then tell the loader to go to that frame.

Make it loop

In the 3rd frame, Control layer, place an action to loop back to the first frame. Simple!

» Level Advanced

Added: 2001-05-08
Rating: 8 Votes: 427
(10 being the highest)
» Author
No details available.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.