Solved

Flex 4  12 Second Countdown with progress bar

Posted on 2011-02-20
3
1,248 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Flash builder 101 tutorial 3 431
Need to show popup window instead of expanding functionality. 10 265
adobe air 1 297
Play RTMP without Flash 3 524
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…
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

770 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