Mind the traps – Publishing Stage3D content to mobile

Finally AIR 3.2 for mobile is out – and it’s performance is quite good! Grab your favorite Android device and test it out with this APK. It’s a car model consisting of 30K polygons, done in Away3D 4 beta.

Some things to keep in mind:

Overlay the latest AIR 3.2 SDK

Go to http://labs.adobe.com/downloads/air3-2.html, download the SDK and throw all the files into your Flash Builder SDK 4.5.1 ( or higher ) folder.

Set the correct swf version in Flash Builder

Go to Project -> Properties -> ActionScript Compiler and paste the following after your locale setting: -swf-version 15. Do not use -swf-version 13 as it’s an older version of AIR. It works, but will kill your z-sorting for 3D content.

Make the correct settings in your app-xml

In my experiments Stage3D in AIR 3.2 only worked with <renderMode>direct</renderMode> and <depthAndStencil>true</depthAndStencil>, both set in the <initialWindow> node. Ah, and don’t forget to target AIR 3.2 in the second line: <application xmlns=”http://ns.adobe.com/air/application/3.2″>

Fix an Away3D bug

Funny thing is: with -swf-version 15 Away3D will cause a runtime error. This is because no standard value for depthAndStencil is set. Go to away3d.core.managers.Stage3DProxy.as and add the following in the beginning of the constructor method ( the first function ):

_backBufferWidth = 800;
_backBufferHeight = 480;
_enableDepthAndStencil = true;

Don’t care about the width and height values, they will be replaced automatically to fit your stage size.

Post your fps

Would be nice if you could post me your device & fps. Thanks in advance!
Ready, steady, go !
And happy coding ;-)