Adobe Flex (ActionScript) Code Problem?

Question by : Adobe Flex (ActionScript) Code Problem?
I’m currently using flex builder 4 (actionscript 4+) and i’m trying to get a progress bar to increase without using any events (just show). Heres my code, which isn’t working at all :

while (Progress1.value<100) { Progress1.setProgress(Progress1.value +1,100) } Any help would be greatly appreciated! Thanks in advance! Best answer:

Answer by modrated
Create a ProgressBar using ActionScript

This example creates a ProgressBar using ActionScript.

Create a new Flash (ActionScript 3.0) document.

Drag the ProgressBar component to the Library panel.

Drag the NumericStepper component to the Library panel.

Drag the Label component to the Library panel.

Open the Actions panel, select Frame 1 in the main Timeline, and enter the following code:

import fl.controls.ProgressBar;
import fl.controls.NumericStepper;
import fl.controls.Label;
import fl.controls.ProgressBarDirection;
import fl.controls.ProgressBarMode;

var aPb:ProgressBar = new ProgressBar();
var aNs:NumericStepper = new NumericStepper();
var progLabel:Label = new Label();


aPb.direction = ProgressBarDirection.RIGHT;
aPb.mode = ProgressBarMode.MANUAL;

progLabel.setSize(150, 22);
progLabel.move(180, 150);
progLabel.text = “”;

aNs.move(220, 215);
aNs.maximum = 250;
aNs.minimum = 0;
aNs.stepSize = 1;
aNs.value = 0;

aNs.addEventListener(Event.CHANGE, nsChangeHandler);

function nsChangeHandler(event:Event):void {
aPb.setProgress(aNs.value, aNs.maximum);
progLabel.text = “Percent of progress = ” + int(aPb.percentComplete) + “%”;

Select Control > Test Movie to run the application.

Click the Up Arrow on the NumericStepper to advance the ProgressBar.

What do you think? Answer below!


There are no revisions for this post.

Tags: , , , ,

No comments yet.

Leave a Reply