Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Would someone be willing to help me with a preloader? 2

Status
Not open for further replies.

Flapman

Technical User
Jul 6, 2001
18
US
I've seen many examples in the forums of preloaders. I was wondering if someone could walk me through a "Preloaders for Flash fo Dummies" version. I never used one and could use some help in placing one into my existing Flash Movie.

Thanks in advance.

Flapman
 
Dead easy.

It's probably best to put this in its own scene in your movie (add a scene in the Scenes panel, call it "loader" or whatever.)

Add three frames to your new scene.

1
//how much of the movie is loaded
loaded=_root.getBytesLoaded();
//how big is the movie
total=_root.getBytesTotal()
//is the movie already loaded?
if(loaded>=total){
//if so skip the loading process
gotoAndPlay(4);
}

2
No script but put a dynamic textbox with the variable set to "percent" on the stage, this is what displays how much of your movie has been loaded so far.

3
//check again how much has loaded
loaded=_root.getBytesLoaded();
if(loaded<total){
//if movie has not fully loaded
//work out how much has been loaded and display it in the textbox
percent=&quot;Loaded: &quot;+Math.floor((loaded/total)*100)+&quot;%&quot;;
//loop around
gotoAndPlay(2);
}

That's all you need for a functional loader - of course you can get way more complex. Slainte

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top