2

The Accelerometer UPDATE event never fires, tho isSupported returns true, when the flash app is running inside the android web browser. How can I make it work?

     this.accelerometer = new Accelerometer();
            accelerometer.addEventListener(AccelerometerEvent.UPDATE, onAccelerometerUpdate);

Ref: http://blogs.adobe.com/cantrell/archives/2010/04/simple_accelerometer_example.html

Ref: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/sensors/Accelerometer.html#isSupported

My device is Samsung Galaxy S.

It does however work as an AIR app on android.

Ref: "Adobe Forums - Accelerometer"

zproxy
  • 3,509
  • 3
  • 39
  • 45

1 Answers1

0

You declared accelerometer as a local variable, so once it is out of scope it will no longer exist. Declaring the var as a class instance member ensures its existence until you no longer need it. http://forums.adobe.com/message/3363673#3363673

The fix was to declare the Accelerometer instance as a class member instead of a local variable.

zproxy
  • 3,509
  • 3
  • 39
  • 45