After this tutorial you
will be able to make yourself a basic preloader
with percentage feature. So here we are going
to learn how make a simple basic percentage preloader
with simple small Loading animation.
First of all in designing part we need a dynamic
text box (with variable name "myDynamicText")
in which we'll show the Percentage of movie loaded.
A movie clip with simple animation, you can make
anything for your loading animation, i have used
a simple animation with loading written and some
running dots. An image or some animation later-on
to check our Preloader.
Put dynamic text box and preloader animation movie
clip on the first frame of layer 1. Make a new
layer for action script and write this on first
frame.
Insert a new blank keyframe in action layer
and add this script on this frame. This will
check that movie is loaded or not, if loaded
it will go further, otherwise it will loop in
first two frames again and again.
myDynamicText = (int((getBytesLoaded() /
getBytesTotal())*100) +"% loaded");
if (getBytesLoaded() != getBytesTotal())
{
prevFrame();
}
else
{
play();
} |
Now insert in a new keyframe in your first
layer to add some image or you can get your
main movie after third frame. You can also copy
first two frames of this movie to your main
movie in first two frames of that movie to get
preloader in any of your movies.
To check this preloader offline first presss
Ctrl+Enter to test your movie then press Ctrl+Enter
again, now it will test your movie with preloader.