To create the simplest flash loader we have to know only two functions:
getBytesTotal() - this function gives back total size of clip;
getBytesLoaded() - this function gives back a quantity of bytes of each flash clip.
Flash Loader Example:
1. We create a clip that must has a minimum weight. Put it into the first frame. Let's give it the name: startclip In the same frame stop clip by using stop()
2. Inside a clip in the first frame we create text area to show percents. the name of variable will be calle: procent
3. use the following ActionScript on the clip:
onClipEvent (load) {
fullsize = _root.getBytesTotal();
}
onClipEvent (enterFrame) {
nowsize = _root.getBytesLoaded();
otnoshenie = nowsize/fullsize*100;
_root.startclip.procent = Math.floor(otnoshenie);
if (nowsize == fullsize) {_root.gotoAndStop(2);
}
}
4. the loader is ready :)
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5