2 Replies Latest reply on Nov 1, 2007 9:35 AM by Tigomark

    Using Time in Flex

    Tigomark
      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 great
        • 1. Re: Using Time in Flex
          Gregory Lafrance Level 6
          Maybe you can create a component that uses the Flex Timer. See these FB2 help topics:
          Controlling time intervals
          Example: Alarm Clock
          • 2. Re: Using Time in Flex
            Tigomark Level 1
            I've also found this but I am getting some weird errors

            <mx:Script>
            <![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();
            }
            }
            ]]>
            </mx:Script>


            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