Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
New Contributor
zyx121322
Posts: 3
Registered: ‎05-17-2011
My Device: Playbook
My Carrier: Playbook

How to addEventListener to Device?

I want to add an eventlistener to device for battery  change.

 

 

private var myDevice:Device=Device.device;

myDevice.addEventListener(DeviceBatteryEvent.LEVEL_CHANGE,onLevelChange);
myDevice.addEventListener(DeviceBatteryEvent.STATE_CHANGE,onStateChange);

 but there are mistakes:

1120,Access of undefined property myDevice

1120,Access of undefined property onLevelChange

 

How to addEventListener to Device?

 

Please use plain text.