Solved

Flex 4  12 Second Countdown with progress bar

Posted on 2011-02-20
3
1,247 Views
Last Modified: 2012-05-11
<mx:ProgressBar id="timerP" x="0" y="73" labelPlacement="right" label="" />

Here I have a progress bar
I want to give the user 12 seconds to choose
they can press a button or default action
Show a Nice indicator as time runs out

I do not know how the timer works,
I feel I can Like this
private var baseTimer:int;
private var timer:Timer

private const TIMER_INTERVAL:int = 10;
timer = new Timer(TIMER_INTERVAL);
timer.addEventListener(TimerEvent.TIMER, updateTimer);

private function updateTimer(evt:TimerEvent):void {
      var d:Date = new Date(getTimer() - baseTimer);
      var sec:String = (SEC_MASK + d.seconds).substr(-SEC_MASK.length);
         counter.text = String(min + ":" + sec + "." + ms);

How to inc progress bar
and default if tmes run out

      }

0
Comment
Question by:yahoolane
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
deepanjandas earned 500 total points
ID: 34940062
You have to create a custom preloader as the Preloader component
private const TIMER_COUNT:int = 12;
private var timer:Timer;

private function init():void {
    timer = new Timer(1000, TIMER_COUNT);
    timer.addEventListener(TimerEvent.TIMER, onTimer, false, 0, true);
    timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete, false, 0, true);
    timer.start();
}

private function onTimer(event:TimerEvent):void {
    var progress:Number = timer.currentCount / TIMER_COUNT * 100;
    //Pass this progress variable to draw your preloader.
}

private function onTimerComplete(event:TimerEvent):void {
    timer.removeEventListener(TimerEvent.TIMER, onTimer);
    timer.removeEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
    //do it here
}

Open in new window


You can get some sample code for drawing preloaders here:
http://iamjosh.wordpress.com/2007/12/18/flex-custom-preloader/
http://www.riagora.com/2010/08/custom-flex-4-preloader/

Warm Regards
Deepanjan Das
0
 
LVL 1

Author Comment

by:yahoolane
ID: 34957811
I wanted to include a progress bar or indicator
For Count Dowm

I was playing with progress bar in 'manual' mode

is there a better way
0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 34957855
The above 2 links will help you to create a custom preloader.

Then pass the progress variable from onTimer method to show the progress.

Warm Regards
Deepanjan Das
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Flex Builder 4.5 3 403
Getting rid of an unwanted URL 5 225
adobe air 1 291
air/as3 : is there a way to simulate TouchEvents? 1 403
First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now