Skip to main content
Inspiring
June 4, 2013
Question

Problems using Native Extensions (Gyroscope) for iOS.

  • June 4, 2013
  • 0 replies
  • 1246 views

I have downloaded the Gyroscope Native Extension for Air and I'm basically trying to install it so I can use the extensions to develop an iOS AIR app that uses my iPhone's Gyroscope.

The Gyroscope Folder has been un-zipped and is placed in a folder alongside the AIR app that I'm developing. I've set the Actionscript settings to point to the gyroscope.ane file and also to the gyroscope.swc file.I don't know if the latter is necessary as I'm all new to this.

My Actionscript reads:-

import com.adobe.nativeExtensions.Gyroscope;

import com.adobe.nativeExtensions.GyroscopeEvent;

import com.adobe.nativeExtensions.GyroscopeIntervalValue

var gyro:Gyroscope;

if(Gyroscope.isSupported)

{

    gyro = new Gyroscope();

    gyro.setRequestedUpdateInterval(1000);

    gyro.addEventListener(GyroscopeEvent.UPDATE,onChange);

}

function onChange(e:GyroscopeEvent):void

{  

    trace("From gyro: " + e.x + " " + e.y + " " + " " + e.z);

}

Which I've basically taken from the webpage https://www.adobe.com/devnet/air/native-extensions-for-air/extensions/gyroscope.html#articlecontentAdobe_numberedheader

And I've added the 3 imports at the top because I believe these should allow these functions / methods (or whatever they are called) to work ?

Unfortunately I'm getting the following errors:-

GyroscopeEvent.as, Line 15001: The name of package 'com.adobe.nativeExtensions' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. /Users/myname/Desktop/programFolder/GyroscopeEvent.as
Gyroscope.as, Line 15001: The name of package 'com.adobe.nativeExtensions' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. /Users/myname/Desktop/programFolder/Gyroscope.as


I don't know where to move the files or how I can get AIR to see this .as files Should I be moving the "Com" folder somewhere better ?

I'm a relative newbie to AIR so I appologise for my ignorance. All I want is a way to get access to the x y and z values from the Gyroscope.

Many Thanks

Gary

This topic has been closed for replies.