|
||||||
|
||||||
Tutorial - Preloading External Flash Movies

Free
Flash Tutorial
Step Five: Creating the Preloader Movie Clip
The Progress Bar that you have just created is just part of the final display. We need to combine it with other information such as the percentage. This is done inside a new Movie Clip:


// Stop the preloader from automatically running
stop();

// Get the total bytes to be loaded
total_bytes = (this._parent.MyExternallyLoadedSWFMovieHolder.getBytesTotal());
// Get the bytes loaded so far
loaded_bytes = (this._parent.MyExternallyLoadedSWFMovieHolder.getBytesLoaded());
// Work out the difference between the total bytes to load and the bytes loaded so far
remaining_bytes = (total_bytes-loaded_bytes);
// Work out the percentage loaded
percent_done = (int((loaded_bytes/total_bytes)*100));
// Set the target bar percentage loaded
bar.ba.target = (percent_done);
// Display progress of percentage loaded in the text box
DisplayProgress = (Math.round(bar.ba._width))+" % loaded.";
// Check to see if everything has loaded
if (bar.ba._width>99) {
// If everything has loaded move onto the next frame
gotoAndPlay(4);
// If everything hasn't loaded then run this code
} else {
/* If everything has not loaded return to frame 2 and try again. This creates a loop and then runs the code above again. This is how everything updates. The values will change as more content is loaded. */
gotoAndPlay(2);
// Close the if-else statement
}

// Tell the external Movie to goto and play frame labeled "Play"
// You can use frame numbers too
_root.MyExternallyLoadedSWFMovieHolder.gotoAndStop("Play");
// Stop on this frame
stop();

The ActionScript Layer should now have three
little a's. The ActionScript
Layer is now finished.
The Text layer





|
Why not try out webwasp's new community. Meet new people, find friends in your area: Webwasp Mates & Dates
•
50114 visitors to this page since
6 Oct 05 •
|
|
|
All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.
|