Join Login


Video Tutorials
Blog




ProgressBar Component


By: RiverCityGraphix      Views: 4020      Share: Bookmark and Share

In this tutorial, you will learn how to use the ProgressBar Component in Flash CS4.

The ProgressBar component can be very handy when creating projects in Flash. Like a preoader, the progress bar displays the current percentage that an object is loaded. Using the ProgressBar can help users stay on your pages longer and be more inclined to wait. People like to know how long they are going to wait and a progress bar is a great way to give them that visual representation.

ActionScript 3.0
var imgurl:String = "Stock Photos/trees.jpg";
var myrequest:URLRequest = new URLRequest(imgurl);

myloader.scaleContent = true;
myloader.load(myrequest);

pbar.source = myloader;
pbar.addEventListener(ProgressEvent.PROGRESS, loadprogress);
pbar.addEventListener(Event.COMPLETE, loadcomplete);

function loadprogress (event:ProgressEvent):void{
percenttxt.text = int(event.currentTarget.percentComplete) + "%";
}

function loadcomplete (event:Event):void{
pbar.removeEventListener(ProgressEvent.PROGRESS, loadprogress);
pbar.removeEventListener(Event.COMPLETE, loadcomplete);
removeChild(pbar);
percenttxt.text = "";
}




Free Source Files Zip

Stock Photos from 123RF