Tuesday, March 13, 2012

Running Starling on Android AIR for Mobile

Problem:
I was watching a video about Starling and decided it would be great to use it in a mobile game or at least begin testing to see if this idea was feasible. Let me tell you how I set it up.

Solution:
I began by working within Flash Professional CS5.5 and tinkering around to get an Android application with Flash Player 11 (new enough to support stage3D), I was able to get Starling to run via the player in HTML using this article, but was unable to get it to work on my Android phone. I ultimately switched to Flash Builder 2.6 to avoid the headache debugging problems between Flash Professional and the Flex SDK 4.6.

After the switch, Starling of course ran without any issues when testing on my computer in both AIR and Flash Player. I then created a mobile ActionScript project to work out any issues on my phone. When I went to run debug the program on my Android, I continued to get an issue from within the Starling library saying that index 0 was out of range.

RangeError: Error #1125: The index 0 is out of range 0.  
at starling.core::Starling()[C:\dev\libraries\starling\src\starling\core\Starling.as:165]
at Startup()[C:\Users\mikekim\Adobe Flash Builder 4.6\StarlingMobileTest\src\Startup.as:21]
at runtime::ContentPlayer/loadInitialContent()
at runtime::ContentPlayer/playRawContent()
at runtime::ContentPlayer/playContent()
at runtime::AppRunner/run()
at AppEntryCommon/run()
at global/runtime::AndroidMobileDeviceAppEntry()

With a quick Google search, I discovered that this was due to the fact that AIR for mobile does not support stage3D. More reading led me to when these features would become available. Adobe AIR 3.2 will have support for stage3D and will be available in the first half of 2012. Currently, a release candidate is available for those interested in working with AIR 3.2 now.

Install Adobe AIR 3.2 RC here

Once I had finished installing the AIR 3.2 RC, I was able to successfully run Starling (with the ParticleDesigner extension) on my Android phone.

Starling w/ ParticleDesigner Extension running  on my Android Galaxy Vibrant
Note: Do keep in mind that applications that rely on the AIR 3.2 upgrade wont work for users who have not installed/upgraded to AIR 3.2 on their mobile device, so please don't publish any applications to market with this dependency. If you do, almost all of your users will not be able to enjoy your hard work for what could be several more months.

UPDATE: AIR 3.2 should be available now for the general mobile public.

No comments: