Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Faking progress bar

As a total beginner in Flash, I am on an assignment where I should create a fake progress bar that should go from 0% - 98%.

Right now I have my line of progress with a total white tween over it that goes from left to right to indicate the fake download. See picture.

alt text

While the tween is running I want to increase the percentage so it matches and stops with 98% - is it possible to do this? And how?

My document is in AS3, but there is no action script yet so it does not matter right now. I mostly do timeline.

Thank you!

like image 701
janhartmann Avatar asked Aug 26 '10 09:08

janhartmann


People also ask

Are progress bars fake?

Significant sections of the data the progress indicator is based on are guesstimates and outright fabrication, but all this deception is there for a reason: it still provides a better user experience than any of the alternatives that you might think of.


1 Answers

Let's assume, your "98%" is a label which has an id "txtPercent" on the stage.

For example, you can write a function which will listen enterFrame event and update your txtPercent label.

Open the actionscript editor on the first frame and write:

import flash.events.*;

//add enterFrame event listener, when timeline frame is passed the listener function is invoked
addEventListener(Event.ENTER_FRAME, updateProgress); 

function updateProgress(event:Event) {  
    //update the label with percent count
    txtPercent.text = (currentFrame / totalFrames * 100).toFixed(0) + "%";
}

Don't forget to put stop(); in the actionscript editor for the last frame.

like image 98
invisible_hand Avatar answered Sep 18 '22 17:09

invisible_hand