Tuesday, December 6, 2011

Using Time in Flex

I am looking to find some examples to create a clock that
counts down from 3 minutes to zero and when the clock hits zero it
will refresh the application. I would also like this clock to be
clickable so that it to would refresh the app.



I have looked all over the net but have not seen any
time/date examples anywhere.



any help would be greatUsing Time in Flex
Maybe you can create a component that uses the Flex Timer.
See these FB2 help topics:

Controlling time intervals

Example: Alarm ClockUsing Time in Flex
I've also found this but I am getting some weird errors



%26lt;mx:Script%26gt;

%26lt;![CDATA[

public class ShortTimer extends Sprite{



public function ShortTimer()

{

// creates a new five-second Timer

var minuteTimer:Timer = new Timer(1000, 300);



// designates listeners for the interval and completion
events

minuteTimer.addEventListener(TimerEvent.TIMER, onTick);

minuteTimer.addEventListener(TimerEvent.TIMER_COMPLETE,
onTimerComplete);



// starts the timer ticking

minuteTimer.start();

}



public function onTick(evt:TimerEvent):void

{

// displays the tick count so far

// The target of this event is the Timer instance itself.

trace(''tick '' + evt.target.currentCount);

}



public function onTimerComplete(evt:TimerEvent):void

{

refresh();

}

}

]]%26gt;

%26lt;/mx:Script%26gt;





It keeps returning the error

Severity Description Resource In Folder Location Creation
Time Id

2 1131: Classes must not be nested. line 15 November 1, 2007
9:26:24 AM 104

No comments:

Post a Comment