Creating a progress bar

How to

Create a progress bar to visually display the amount of progress made towards completing a task.

Solution

Construct the progress bar variable in the root of your class

var myProgress:ProgressBar = new ProgressBar();
//placing this at the class root allows other 
//application elements to reference it

Initialize your progress bar's attributes

//set location
myProgress.x = 50;
myProgress.y = 50;
//set size
myProgress.width = 150;

//set progress to a percentage between 0 and 1
myProgress.progress = 0.1;

//add to stage
this.addChild(myProgress);

Build Requirements

You must include the following class in your project:

import qnx.fuse.ui.progress.ProgressBar;

Discussion

When you create a progress bar, you declare the ProgressBar variable and set its properties to whatever values your application requires. To display the bar, add it to the stage with addChild(). The progress property can be set to a percentage value in decimal format between 0 and 1 anywhere in your application that the object is accessible to update the value of the progress bar.