|
1. Create a rectangle
Draw a horizontal rectangle about 200 - 300 pixels wide and about 50 pixels tall.
2. Convert the outline and box into two separate movie clips
Convert the outline to a movie clip first. Then select the box and convert it to a movie clip called preloader
3. Send the preloader movie clip to the back
We want to see the outline at top so right click, send to back, the preloader movie clip.
4. Select the first frame and add the following code.
this.onEnterFrame = function() {
amount = this.getBytesLoaded() / this.getBytesTotal();
preLoader._width = Math.round(amount*boxwidth);
if(amount == 1) {
this.gotoAndStop(2);
delete this.onEnterFrame;
}
}
5. Make sure you replace boxwidth
You need to replace boxwidth in the code with the actual width of the preloader you made
6. Test out your movie!
Test out your movie... It should work perfect... Download source files or watch the video if you need help
|