Question

I'm using FDT Free for developing a little game on mobile apps. For controlling the game, the Gyroscope is required, therefore I've added Adobe's gyroscope AIR extension (ANE and SWC) to the lib folder of my project.

When testing on a mobile device, the extension works fine; however, when trying to run the app as a desktop application, I receive the following error:

The content cannot be loaded because there was a problem loading an extension: Error: Requested extension com.adobe.gyroscope is not supported for Windows-x86.

For excluding code that uses the gyroscope on the desktop run configuration, I've added the following arguments to the compiler arguments:

-define+=CONFIG::MOBILEDEVICE,false
-define+=CONFIG::DESKTOP,true

Also, I've added code snippets for not compiling certain parts of my code that use the extension:, e.g.:

CONFIG::MOBILEDEVICE {
if (Gyroscope.isSupported) 
{
    gyro = new Gyroscope(); 
    gyro.setRequestedUpdateInterval(1000); 
    gyro.addEventListener(GyroscopeEvent.UPDATE, onGyroUpdate); 
}

Using conditional compiling works fine, but what can I do to prevent the ANE and SWC from being included when running my desktop run configuration?

Was it helpful?

Solution

I can't tell if the source code for this extension is available, but if it is, it might be easier for you to simply build support for a default platform into the extension than to worry about conditional compilation. You can visit http://www.adobe.com/devnet/air/articles/building-ane-ios-android-pt2.html and read the section on creating a default library to understand how it is to be done. It just requires a simple AS3 project with stub methods that match the public interface of the NE. Then you can compile the NE and it will work without problems on any platform.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top