Flash Templates Tutorials - Flash Preloader
Lets consider the real situation: for several days you have been creating your brainchild which of course will make your competitors burst with envy, you have imported all the beautiful images you had and have recorded a voice comment – it is beautiful, a little bit weighty (like 2-3MB) but still beautiful. You have uploaded it into your website and decided to see how it is playing but everything is just bad: pictures are loading in fits and stars, details are weird and also the voice dies out abruptly but what’s most disappointing that there is nothing beautiful any more here. So, one can really rate on how your movie will be launched even without internet connection.
What data do we need in order to define the uploaded movie volume? First of all we have to know the number of pictures in the movie. One can do it manually, however we want to create a versatile Preloader working regardless of what project we use it in and the “_totalframes” property can help us here. And we should also know how many pictures are uploaded in this very moment – use “_framesloaded” here. These two properties are enough to count the loading data in percents as it is used in internet. The Preloader should be consisted of at least two pictures, the first one will be counting the required value while the second will be checking the whole downloading and to start playing the movie if it is downloaded.
Insert the following script into the first picture:
Set Variable: "load" = Int ( _framesloaded / _totalframes * 100)
I.e. set the “load” variable the value of the loaded movie in percents. Divide the number of already loaded pictures into its overall amount and then multiply it by 100. However, it is preferably to round the achieved number, using the “Int” function which simply deletes all the numbers going after the comma.
Place the checkup and data output in the second picture:
Set Variable: "showtext" = load & "%"
If (load < 100)
Go to and Play (1)
The first line shows data about the loading in percents, that is why it is necessary there was a text field with “showtext” name at the scene.
Then goes the complete loading checkup and if there is less than 100% loaded we go back to the first picture to get the new value. It is the typical version of Preloader but not the only one. If your project has more than 500 KB then it is much boring to watch the slow crawling percents. And the step-by-step loading is much more attractive: check the loading of the first small part of the movie, start playing it and while this very scene is playing the browser will continue the loading; on completion of the scene there goes the next scene loading checkup and if it is not loaded completely ask to wait then. In this case it is necessary to count the possible time of loading and scene playing.
Use the various value of loading and scene playing for the real checkup.
For the step-by-step Preloader one can use the above method of loading count, however, it is much more effective to check the separate (final) picture loading especially if your movie consists of several scenes.