Adobe AIR Gyroscope Native Extension with Euler Angles (roll, pitch, yaw) for iOS

UPDATE: I have released the extension including source on google code with some changes.
Euler Gyroscope ANE on Google Code

I baked my very first AIR iOS Native Extension. It’s just an adapted version of this version from Adobe. Because in my opinion the data of radians per second aren’t really good to handle. So I looked into Apples API documentation and found out that there are Euler Angles in the CMMotionManager CMDeviceMotion classes. So I just changed a few lines in the Objective-C Code. I learned much from this tutorial Native Extionsion for Adobe AIR and iOS 101 by Liquid Photo

NSString *myStr = [NSString stringWithFormat:@"%f&%f&%f&%f&%f&%f", 
rotate.x, 
rotate.y, 
rotate.z, 
motionManager.deviceMotion.attitude.roll, 
motionManager.deviceMotion.attitude.pitch, 
motionManager.deviceMotion.attitude.yaw];

[motionManager startDeviceMotionUpdates];

motionManager.deviceMotionUpdateInterval = 0;

And added these three parameters roll, pitch and yaw to the Actionscript Gyroscope Event.

new GyroscopeEvent(GyroscopeEvent.UPDATE, _x, _y, _z, _roll, _pitch, _yaw)

You can download source and final iOS .ane Native Extension file here:
iOS Air Native Extension Gyroscope – with Euler Angles

Convert PNG to JPEG XR for use in Flash / Flex and AS3

A new feature in Flash Player 11 and Adobe AIR 3 is the feature to use JPEG XR. A enhanced JPEG format.

But how to generate or convert JPEG XR files. I found no Photoshop Plugin. All open source tools aren’t able because of licensing problems. The only tool i found is XN View, which can convert PNG files including the alpha channel to JPEG XR.

But you have to use the „Batch Convert“ tool. Only there is the option to convert to JPEG XR.

After converting you can load and use the JPEG XR files via Actionscript. e.g. with a Loader or via embedding. It behaves like a PNG file but with much smaller size while keeping very good quality.

Adobe AIR 3: How to build a Captive Runtime, Standalone Bundle Executable App

The challenge was to build a Adobe Air 3 Standalone Executable. Also called a „Captive Runtime“ or a Bundle.

Here are some better descriptions:
http://www.adobe.com/devnet/air/articles/air3-install-and-deployment-options.html

But it was not so easy as it sounds because the order of the adt options are very important!

If the order isn’t correct you get the error „-storetype is required„.

And if you are behind a firewall or no internet connection, the timestamp server isn’t reachable. So use „-tsa none“ if you get „Could not generate timestamp: Connection timed out: connect„.

Here is my ant task which do the job with the correct order. But the order of the options in a terminal command should be the same.

<target name="07. [package exe]">
	<mkdir dir="${publish.dir}"/>
	<input message="certificate password:" addproperty="certPassword" />
	<java jar="${sdk.dir}/${adt}" fork="true" failonerror="true" dir="${deploy.dir}/">
		<arg value="-package" />
		<arg value="-keystore"/>
		<arg value="${air.certificate}"/>
 
		<!-- NATIVE_SIGNING_OPTIONS -->
		<arg value="-storetype"/>
		<arg value="pkcs12"/>
		<arg value="-storepass"/>
		<arg value="${certPassword}"/>
		<!-- <arg value="-tsa" />
		<arg value="none" /> -->
		<arg value="-target" />
		<arg value="bundle" />
		<!-- Name Of File To Create-->
		<arg value="${publish.dir}/${publish.exe}" />
		<!-- App Descriptor-->
		<arg value="${application.descriptor}" />
		<!-- Files To Package -->
		<arg value="Icon*" />
		<arg value="Default*" />
		<arg value="iTunesArtwork.png" />
		<arg value="-C" />
		<arg value="${deploy.dir}/" />
		<arg value="${deploy.swf}" />
	</java>
</target>

Hope this helps some people having the same problems.

Fastest way to install debug build on iPhone.

If you are developing with an other framework than Xcode, Flash or Appcelerator Titanium it is a long way to get the .ipa file installed on your iPhone. You have to update the .ipa in your iTunes or the iPhone Configuration Utility and than you have to Sync your iPhone again. That needs time an many clicks and drag & drop operations. So I found a new way. It makes use of the OTA (Over The Air) installation feature of IOS 4 and higher.

Step 1: Configuration

  1. Install (If you did not have one installed already) a web server on your local machine. MAMP on Mac or XAMPP on Windows
  2. Create a new directory for the OTA files somewhere
  3. Create an alias in your http.conf to that folder
    Alias /yourapp "/Users/christoph/Documents/path/to/OTA"
  4. Use iOS Beta Builder to create the files to the OTA folder
  5. Open Safari on the iPhone type in your local machines ip plus alias e.g.: http//192.168.0.40/yourapp. Click install and OK

Step 2: Use it after every build

And everytime you have an update you have only to do these steps (iOS Beta Builder is opened and used one time):

  1. Switch to iOS Beta Builder, press „Generate Deployment Files“, the folder should be correct, so just „Choose Directory“
  2. Switch to Safari, press the install link from the already opened local machines URL

For me it’s time saving.

Any other ideas how to improve the process to get .ipa files installed on the iOS device? Please comment.

Found some old browser games

While a research I found some very old browser games I developed many years ago:

The Blind People Simulator
A JS/DHTML Game from 1997. Does anyone knows Netscape today 😉
PLAY
For this we got a small article in a PC magazine and one or two angry mail how we can make funny games about disabled people.

Stress-O-Matic
A small Flash game like „Punch the monkey“. Try bill, santa or general as secret codes.
PLAY
No guarantee that they will work in modern browsers.