package { import com.phidgets.*; import com.phidgets.events.*; import flash.display.Sprite; public class actionscript_phidget_system_PhidgetAccelerometerTest extends Sprite { private var phid:PhidgetAccelerometer; public function actionscript_phidget_system_PhidgetAccelerometerTest() { phid = new PhidgetAccelerometer(); 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.ACCELERATION_CHANGE, onAccelerationChange); phid.open("localhost", 5001); } private function onError(evt:PhidgetErrorEvent):void { trace(evt); } private function onAttach(evt:PhidgetEvent):void{ trace(evt); trace(phid.getAccelerationMax(0)); trace(phid.getAccelerationMin(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 onAccelerationChange(evt:PhidgetDataEvent):void{ trace(evt); } } }