?
Solved

Flex 4  12 Second Countdown with progress bar

Posted on 2011-02-20
3
Medium Priority
?
1,263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
deepanjandas earned 2000 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

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

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

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…
Check out the latest tech news, community articles, and expert highlights in August's newsletter.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

777 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