title: as3 timer turn external device on and off
body: <p>I am trying to program a Phidgets device to repeatedly turn an external light on for .5 sec and off for .5 sec.</p>
  
  <p>(these times correspond to Frames 1 and 11 of a 20 frame movie clip. </p>
  
  <p>I've tried to insert the on- and off- commands into the movie clip, but they don't transfer to the main stage, so now I'm just trying to program the light to go on and off from the main program</p>
  
  <p>The code below turns the light on and off at the SAME TIME- which means NOTHING HAPPENS.
  Does anyone know how to delay the timer so that the off command comes 500 msec AFTER the on command ?
  THanks</p>
  
  <pre><code>phid.addEventListener(PhidgetEvent.ATTACH,onAttach);
  //connects Phidget to software 
  
  function onAttach(evt:PhidgetEvent):void{
      trace(evt);
  }
      var phidControl:Timer = new Timer (500);
      phidControl.addEventListener(TimerEvent.TIMER, lightOn);
          function lightOn (evt:TimerEvent):void {
  
          phid.setOutputState(0, true);} //this turns the light on
  
  
      enter code here
      var phidOff:Timer = new Timer(500);
      phidControl.addEventListener(TimerEvent.TIMER, lightOff);
       function lightOff(evt:TimerEvent):void {
           phid.setOutputState(0, false);//this turns light off
       }
  </code></pre>