title: How to use android accelerometer in flash using AIR for android
body: <p>I am testing out the accelerometer and I tried using the default AIR for Android example and am now trying to make my own game in flash. I copied off of the example's code:</p>
  
  <pre><code>    import flash.events.Event;
  
  var accelX:Number;
  var accelY:Number;
  
  var fl_Accelerometer:Accelerometer = new Accelerometer();
  fl_Accelerometer.addEventListener(AccelerometerEvent.UPDATE, fl_AccelerometerUpdateHandler);
  function fl_AccelerometerUpdateHandler(event:AccelerometerEvent):void
  {
      accelX = event.accelerationX;
      accelY = event.accelerationY;
  }
  
  ball.addEventListener(Event.ENTER_FRAME, moveBall);
  function moveBall(evt:Event){
      ball.x -= accelX*30;
      ball.y += accelY*30;
  
      if(ball.x &gt; (480-ball.width/2)){
          ball.x = 480-ball.width/2;
      }
      if(ball.x &lt; (0+ball.width/2)){
          ball.x = 0+ball.width/2;
      }
      if(ball.y &gt; (800-ball.width/2)){
         ball.y = 800-ball.width/2;
      }
      if(ball.y &lt; (0+ball.width/2)){
          ball.y = 0+ball.width/2;
      }
  </code></pre>
  
  <p>I keep on getting this error: </p>
  
  <pre><code>Scene 1, Layer 'actions', Frame 1, Line 6   1046: Type was not found or was not a compile-time constant: Accelerometer.
  Scene 1, Layer 'actions', Frame 1, Line 6   1180: Call to a possibly undefined method Accelerometer.
  </code></pre>
  
  <p>I know I am making a huge novice error but I would really appreciate some help, thank you for who ever took the time to read this.</p>