A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11358 Flash Movies | 4 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Sean
» Title: Customizable Flash Drop down menu
» Description: The native source files for building a customizable menu roll down.
» More by Sean


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 5709 Flash Sites | 4 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: Sandy 3D Engine for Flash
» Description: Sandy is a Flash 3D engine, available in 3 versions: AS2, AS3 and haXe


Random Links | Add your own Flash Related Links
Flash Tutorials 1302 Tutorials 7 New Tutorials Added!
What's New | Top100

» MySpace profile flash slideshow
» Display YouTube videos in self-customized Flash video player on website
» How to make cool 3D flash banners for your website?
» Make a Valentines Day Slideshow with Music
» How to remove red eyes from a photo?
» How to convert SWF to Animated GIF on Mac
» How to Make a Platform Game using AS 2 - Part 1
» How to make a flash Greeting e-card
» How to extract Youtube video to MP3 audio for Mac
» Unknown Tag: Title10
Random Tutorial | Add Site

Web Manager
University of Redlnads
US-CA-Redlands

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Interactivity

Categories Smooth bar preloader
Author: Yuri Demidov | Website: http://www.pixelsystem.com |

 
Page 1
1

Following these easy steps you will be able to have a great looking and smooth moving preloader bar in just a few minutes.

Step 1

In your movie, create a new movie object and call it "loadbar".
In the object create two layers. On the first (bottom) layer, create a thin (or wide) rectangular shape forming a load bar. Position it at coordinates x:0 y:0. The height of the bar can be anything you want, but make sure the width reflects multiples of 100 (100px, 200px and so on). 100px should be enough for a nice thin stylish bar. You can have the bar be any width, and you can experiment with that on your own once you complete this turotial and have a clear understanding of the math involved. This bar can be any color you like as it is the place-holder for the moving progress bar which will fill this space as the movie loads. My suggestion is to have a crisp outline of the bar with space inside allocated for the moving progress. You dont have to convert this shape to an object, so lets just call it placeholder in the rest of the tutorial.

Now, on the second layer, create another rectangle so that when you position it on top of the placeholder, it forms your complete progress bar as it should appear when 100% of the movie is loaded. Make sure to convert this shape into a movie. Call it "progressbar". Se the width of progressbar to 0 via it's movie properties.

Now you have a movie which contains just one frame with 2 layers. The bottom layer has the placeholder rectangle and the top layer the progressbar movie.

Step 2

Make sure that the first 2 frames of your main movie are completely empty on all layers. Create 2 new layers and call them "scripts" and "preload". Take the movie object (loadbar) and place it on the very first frame (make it a key frame) of the "preload" layer.

Now create a key frame on the first frame of the "scripts" layer, go to the actions of that first frame and enter the following code:

_root.loading = getBytesLoaded();
_root.total = getBytesTotal();
_root.incremented = 1;


If you made the width of the placeholder shape 100, leave incremented = 1, otherwise change it to reflect the width of your placeholder shape (2 if it is 200, 3 if 300 and so on).

Now create a key frame on the second frame of your movie in the "scripts" layer (this frame should be empty on all layers up till now) and add the following code to its actions:

_root.loadbar.progressbar._width=((Math.round(_root.loading/_root.total*100))*_root.incremented); if (_root.loading<_root.total) gotoAndPlay(_currentframe-1);

Now go the the "preload" layer and add a frame to it so that you have 2 frames taken by the loadbar movie on that layer. Make sure that this layer only has 2 frames and does not continue any further. Make sure that the "scripts" layer has the 3rd frame as a key frame with no code in it (or whatever code you decide to have there, except for the code we just added to the first and second frames). Its a good idea to use this "scripts" layer for whatever code you will end up having in the rest of your movie.

What you should have now in your movie is the following:

First 2 frames are taken by the script code we just added and the loadbar movie on their respective layers. All other layers of the movie (if you have any other layers) are completely empty of any code on the first 2 frames. They may contain objects as you may want something to appear on the loading screen besides the progress bar (like text for example), just make sure that you understand that the first 2 frames will keep on looping until the movie is loaded 100% at which point the movie will continue onto frame 3 and so on. The following frames (starting from frame 3) are wharever you decide to have in your movie.

Now you can play with the colors of the bar and the code if you like. What you have is a smooth progress bar which truly reflect the loading progress of your movie.

There is another way of making a bar like this. The other way is to use masks and it is used to have more complex progress animation. I will post a turorial on it soon.

Have fun and enjoy your new loading progress bar.

1

» Level Intermediate

Added: : 2004-11-03
Rating: 5.32 Votes: 16
Hits: 818
» Author
pixelsystem.com is a progressive design studio based in the U.S.
» Download
Download the files used in this tutorial.
Download (0 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers