Re: [flexcoders] Time Based State Transitions

2007-02-27 Thread Mike Britton

You could use Timer, but this would also work.  You may want to switch it to
use a Singleton.

Usage:

var myTraceBack:CommunicationManager = new CommunicationManager();
myTraceBack.addEventListener(CommunicationManager.ANIMATION_COMPLETE,
onDoneMove);
myTraceBack.startCountdown(1000);


package
{
   import flash.display.Sprite;
   import flash.events.TimerEvent;
   import flash.utils.Timer;
   import flash.display.MovieClip;
   import flash.events.Event;

   [Event(name=done, type=flash.events.Event)]

   public class CommunicationManager extends Sprite
   {
   public var myOwner:MovieClip;
   public static var ANIMATION_COMPLETE:String = done;

   public function CommunicationManager()
   {
   super();
   }

   public function startCountdown( duration:Number ):void
   {
   var minuteTimer:Timer = new Timer(duration, 1);

   minuteTimer.addEventListener(TimerEvent.TIMER, onTick);
   minuteTimer.addEventListener(TimerEvent.TIMER_COMPLETE,
onTimerComplete);

   minuteTimer.start();


   }

   public function onTick(event:TimerEvent):void
   {
   trace(onTick);
   }

   public function onTimerComplete(event:TimerEvent):void
   {
   trace(onTimerComplete!);
   this.dispatchEvent(new Event(done));
   }

   }
}


hth,

Mike Britton

On 2/26/07, nextadvantage [EMAIL PROTECTED] wrote:


  How would I go about changing view states say every 10 secs... with a 1
sec fade?

 





--
Mike
--
http://www.mikebritton.com
http://www.mikenkim.com


Re: [flexcoders] Time Based State Transitions

2007-02-27 Thread Clint Tredway

you can use setInterval or setTimeout

On 2/26/07, nextadvantage [EMAIL PROTECTED] wrote:


  How would I go about changing view states say every 10 secs... with a 1
sec fade?

 





--
http://indeegrumpee.spaces.live.com/


[flexcoders] Time Based State Transitions

2007-02-26 Thread nextadvantage
How would I go about changing view states say every 10 secs... with a 1 
sec fade?