Tuesday, March 13, 2012

Running Starling on Android AIR for Mobile

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.

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.

Monday, March 12, 2012

Best JavaScript OOP Tutorial I've Seen

If your new to JavaScript but have programming experience with other object-orientated languages, you will probably find that JavaScript is a little bit different animal.

Lee Brimelow does an incredible job at explaining JavaScript OOP design with a easy-to-follow and slow paced 20 minute video.


Thursday, March 8, 2012

JavaScript Throwing HTML Elements


While working on a programming project that would show my wife how much I loved her on Valentine's Day (yes, I'm that nerdy, no traditional flowers from me), I wanted to build a slideshow with images that my wife could drag and throw photos around and so on. While I looked for something already written that would do the trick but I did a lot without canvas and couldn't change at this point. I never found anything that would allow for that 'throwing' action and ended up not having that functionality available in the program.

For kicks, I wrote my own.

Solo Item
Multiple Items
Photo Items

While it is certainly not perfect and more of a proof of concept more than something used in a production platform, I am hoping it offers something to someone out there. The concept is simple enough.

If you use this code please credit me. Thank you.