Join Login

Video Tutorials

ProgressBar Component

By: RiverCityGraphix      Views: 4083      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;

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);
percenttxt.text = "";

Free Source Files Zip

Yahoo! Small Business