topical media & game development

talk show tell print

actionscript-phidget-system-PhidgetMotorControlTest.ax

actionscript-phidget-system-PhidgetMotorControlTest.ax [swf] flex


  package
  {
  
          import com.phidgets.*;
          import com.phidgets.events.*;
          
          import flash.display.Sprite;
                  
          public class @ax-actionscript-phidget-system-PhidgetMotorControlTest extends Sprite {
                  
                  private var phid:PhidgetMotorControl;
                  
                  public function @ax-actionscript-phidget-system-PhidgetMotorControlTest() {
                          
                          phid = new PhidgetMotorControl();
                          
                          phid.addEventListener(PhidgetEvent.CONNECT,        onConnect);
                          phid.addEventListener(PhidgetEvent.DISCONNECT, onDisconnect);
                          phid.addEventListener(PhidgetEvent.DETACH,        onDetach);
                          phid.addEventListener(PhidgetEvent.ATTACH,        onAttach);
                          phid.addEventListener(PhidgetErrorEvent.ERROR, onError);
                          phid.addEventListener(PhidgetDataEvent.INPUT_CHANGE, onInputChange);
                          phid.addEventListener(PhidgetDataEvent.VELOCITY_CHANGE, onVelocityChange);
                          phid.addEventListener(PhidgetDataEvent.CURRENT_CHANGE, onCurrentChange);
                          
                          phid.open("localhost", 5001);
                  }
                  
                  private function onError(evt:PhidgetErrorEvent):void {
                          trace(evt);
                  }
                  private function onAttach(evt:PhidgetEvent):void{
                          trace(evt);
                          phid.setAcceleration(0,1);
                          phid.setVelocity(0,0);
                  }
                  private function onDetach(evt:PhidgetEvent):void{
                          trace(evt);
                  }
                  private function onConnect(evt:PhidgetEvent):void{
                          trace(evt);
                  }
                  private function onDisconnect(evt:PhidgetEvent):void{
                          trace(evt);
                  }
                  private function onInputChange(evt:PhidgetDataEvent):void{
                          trace(evt);
                  }
                  private function onVelocityChange(evt:PhidgetDataEvent):void{
                          trace(evt);
                  }
                  private function onCurrentChange(evt:PhidgetDataEvent):void{
                          trace(evt);
                  }
          }
  }


(C) Æliens 27/08/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.