|
This is a so called Native Extension for Adobe AIR 3, which will allow you to read the output of the proximity sensor on devices which have one. Both Android and iOS support is provided, as well as a "default" implementation which will never dispatch any events (necessary to run app in the simulator on desktop.) The "android" and "ios" folders contain the native libraries for Android (Java) and iOS (C/ObjC) respectively. The "default" folder contains the dummy AS3 implementation, and the "as" folder contains the AS3 extension interface. For more information on Native Extensions, see the page at the following URL:http://www.adobe.com/devnet/air/native-extensions-for-air.html How to useIn the bin folder you will find both an ANE file and a SWC file. Configure your tool (e.g. Flash Builder 4.6) to use the ANE file while packaging, and add the SWC file to your SWC path. That should be enough to set it up. The class to use is called ProximitySensorInterface and resides in these.riol.anes.proximitysensor package. It has a start() and a stop() method to start and stop proximity sensor polling respectively. When the sensor detects a change in proximity, a StatusEvent is dispatched. Here's some very basic sample code, in lieu of a proper example: - import se.riol.anes.proximitysensor.ProximitySensorInterface;
- var proximity : ProximitySensorInterface;
- proximity = new ProximitySensorInterface();
- proximity.addEventListener(StatusEvent.STATUS, handleProximity);
- proximity.start();
- function handleProximity(ev : StatusEvent) : void
- {
- trace('proximity: '+ev.level);
- }
复制代码 How to help developSee README files in the folders for the respective platforms/targets for build instructions. TODO:- Clean up interface (possibly rename main class)
- Replace with better event type than the standard ANE StatusEvent
- Write build instructions for all platforms.
[size=15.555556297302246px]
[size=15.555556297302246px]
[size=15.555556297302246px]
[size=15.555556297302246px]
[size=15.555556297302246px]
[size=15.555556297302246px]
[size=15.555556297302246px]相关链接:
[size=15.555556297302246px]
https://github.com/richardolsson/proximity-sensor-ane
http://xiaxingwork.iteye.com/blog/1701734
|