Thursday 10 November 2011

Flash Preloader

Today we created a preloader in flash which enables you to load content which is on the various pages before the webpage initially starts up. Implementing a preloader into your website enables you to have a visual guide on the loading progress of the website while if you didn't have preloader you have to guess when the webpage has fully loaded.


Here is the code which did this

onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
if (percent == undefined) percent = 0;
percent -= (percent-((loading/total)*100))*.25;
 per = int(percent);
 percentage = per+"%";
 loadBar._width = per;
 if (percent>99) {
  _parent.gotoAndPlay(3);        }}

No comments:

Post a Comment