Wednesday, July 30, 2008

simple Preloader

Hi,
In this I like to tell how to create a pre loader

place a dynamic text field with the name pre. Make sure this text box extends in the first 3 frames

Frame 1 code:
per.text = "0%";

Frame 2 code:
pre.text = (Math.floor(_root.getBytesLoaded()/_root.getBytesTotal()*100)+"%");
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
pre.text = "100%";
gotoAndPlay("main_movie");
}

Frame 3 code:
gotoAndPlay(2);

Frame 4:
Place a label as main_movie

This is the most common and simple type of pre loader

as i all ready specified place a dynamic text field which is over there in all the first 3 frame
this will start play in that case the first frame will set the text field as 0%.
Then it will come to 2nd frame and check weather the total size of file in bytes is equal to total number of bytes loaded, if it is equal it will go and play the 4th frame where it is named as main_movie or else it will go to the 2nd frame where it will check once again for the total bytes loaded with the Total file size.
hope this will help...
Let me tell some advanced type of pre loader soon.

No comments: