We will use a function percentLoaded(); in this tutorial, to get the percentage of the movie loaded.
Description ------------ This function returns the percent of the movie that has so far loaded into your trmporary file folder, its possible values are from 0 to 100. It always returs an integer value (means there will be no vlaue with point as 21.4 or 34.5, it will always return a round vlaue as 21 or 34. So its really handy function because this way we can let our movie goto any Frame number.
I assume that you already know how to make a simple preloader for your movies. You will have to make two scences, in the first scene (will be will at the top) you will place your percenatge preloader and in the next scene (Scene 2) you will place your movie to be loaded(main movie)..
Ok - follow the steps now.
1. In this step we will make the designing part how our percentage preloader will look like. Put some static text "Movie Loaded :" in Scene_1.
2. Make a dynamic TEXT box and on the its properties NAME, put per infront of it. It means per is the object name of your dynamic text box. Check the Target and give Variable name as percent.
3. Make BAR which you want to dusplay while loading movie, I have made a simple bar with Radial Gradient property. Convert it to sprite bar. Now reduce the width of bar to 2 pixels, so it will look like this.
Ok - now in your bar sprite place a Stop() action on frame number 1. Place a move effect of 100 Frames in front of your Bar, and stretch it how big bar you want, Just like this
4. On frame number 1 of Scene (preloader) paste the following code onEnterFrame() { myVar = percentLoaded(); percent = myVar+"%"; tellTarget (bar) { gotoAndStop(myVar); } if (myVar >= 100) { gotoSceneAndPlay("Scene_2",2); } } onFrame (2) { prevFrameAndPlay(); }
so your movie will look like
Explaination of Above Code. ---------------------------- myVar = percentLoaded(); In this line the number which is returned by percentLoaded() function in saved in variable name myVar. So that we can further use this myVar anywhere.
percent = myVar+"%"; As we know percent is our dynamic text box, in this line we are displaying the percentage of movie downlaoded.
tellTarget (bar) { gotoAndStop(myVar); } In the above code we are goign to next frames of BAR sprite in which our bar is placed.
if (myVar >= 100) { gotoSceneAndPlay("Scene_2",1); } In the above code we are putting a condition that if movie is 100% loaded then goto SCENE2 (where your main movie in placed) and Play. You can put any action you want after your movie is downloaded.
5. Insert Scene_2, and place you graphics there. So that it will be redirected to Scene 2 after your movie is 100% loaded.
You are DONE !.. thats it.
Dont forget to Export your Movie with Flash Player 6. Goto Export tab,