AIR for Android Books

I’ve been thoroughly enjoying the AIR for Android pre-release but given my limited time I certainly haven’t been able to explore everything it has to offer. So it was extremely pleasing to find out that there will be a few books on the subject coming out at the end of this year.

O’Reilly will be releasing ‘Developing Android Applications with Adobe AIR‘. Written by ActionScript guru Véronique Brossier, it promises to cover many topics including gestures, screen orientation, geolocation, scrolling, animation, and optimisation.

Published by Apress, ‘Pro Android Flash Games‘ by Scott Janousek and Jobe Makar looks like it could also be an invaluable resource for budding Flash mobile developers. As well as covering the Adobe AIR API, the book will also explore how to take advantage of hardware acceleration, and discuss game design principles and considerations for the Android platform.

While I’m here I think I’ll take the time to plug another book that I’ve found extremely useful when tinkering away on various Flash Lite projects. ‘Flash on Devices‘ by Scott Janousek, Elad Elrom and Thomas Joos is a very comprehensive book looking at Flash across various mobile platforms. Hopefully we’ll see an update of this book at some point.

With AIR for Android hopefully being released later this year, Apple accepting content written using the Packager for iPhone again, and Flash Lite 4 appearing on many upcoming devices, it is an exciting time again for Flash developers. I’m looking forward to seeing all the great content the Flash community produces for mobile.

Masking the global trace function

Here’s a little trick I learned today regarding name spaces.

I was writing a little custom debug class and decided to grace it with its own static trace() method that would ultimately make a call to ActionScript’s global trace() function.

Basically I wanted all my tracing to go through this class but still maintain the familiar trace name. So my tracing calls would now look like this:

Debug.trace( "Oops! Something bad has happened" );

The code for my debug class went something like this:

package
{
    public class Debug
    {
        static public function trace( message :String ) :void
        {
            // Call the global trace function.
            trace( message );
        }
    }
}

Did you spot the obvious problem?

Yeah that’s right. It won’t in fact call the global version of trace() but instead recursively call the class’ static implementation until the stack explodes.

So how exactly do we get round this problem? Well you could simply change the name of the static method to something like output() or traceMsg() but I really wanted to mask the global trace() function by using its name.

We’ll here’s what to do.

Create a variable of type Function that points to the global trace() function’s definition. When you need to call the global version, make calls through the variable.

My corrected class looks something like this:

package
{
    import flash.system.ApplicationDomain;

    public class Debug
    {
        static private var globalTrace :Function;

        // Static initialiser block.
        {
            globalTrace =
                ApplicationDomain.currentDomain.getDefinition( "trace" )
                as Function;
        }

        static public function trace( message :String ) :void
        {
            // Call the global trace function for real this time.
            globalTrace( message );
        }
    }
}

A big thanks to @kaeladan for the solution. If he had a dollar for every time he’s helped me out over the years he’d be a very rich man. Unfortunately for him, he doesn’t. Follow him on Twitter – you can learn a lot from this dude.

Stay on Target

So how’s my X-wing Targeting Computer coming along? Is it finished? Well I’m getting there but you know what they say, “The last 10% of a software engineering project accounts for 90% of the development time”, and it’s definitely turning out to be true for this one.

As well as ironing out a large number of bugs I’ve also started making some changes to the user experience after some feedback from early preview builds. They aren’t major changes but I think they’re required.

I was trying to make everything look as authentic as possible but have conceded that it makes more sense to use native UI components when communicating certain things to the user. However I’ll definitely be keeping these UI components to a minimum so that it won’t spoil the illusion for all you X-wing pilot wannabes out there.

I’m also in the process of changing the Geolocation service that I’m using after being unhappy with my original choice.

So things are coming along nicely. Now I better get back to making those UI changes.

Samsung Galaxy Tab and Flash

Flash Player 10.1 for mobile is a significant step for the Flash Platform but I believe tablet devices is where Flash could really flourish.

Don’t get me wrong, being able to check-out Flash content on mobile phones is pretty damn impressive, but the small screen is always going to create usability issues, especially for the majority of existing Flash content already out there.

I believe that Flash really needs to get some significant penetration across tablets for the technology to stay relevant. So this video from Adobe TV showing off Flash Player 10.1 running on the Samsung Galaxy Tab has got me pretty excited – yeah I know, I’m a Flash fan-boy.

The Galaxy Tab is a gorgeous looking device and its 7-inch screen should help prevent many of the usability issues I’ve experienced running Flash on the more restricted mobile phone screens. The video doesn’t show off as much content as I’d like but hopefully the Galaxy Tab’s hardware spec is sufficient to run most Flash-based sites that users are likely to visit.

Native 64-bit Flash Player

Yesterday Adobe announced the availability of “Square” – their native 64-bit Flash Player for all major desktop operating systems including Windows, Mac and Linux.

As well as the native 64-bit support, Adobe has been collaborating with Microsoft’s Internet Explorer team to take advantage of the hardware-accelerated graphics capabilities in the newest version of IE. Apparently Adobe’s engineers have seen the Flash Player performance improve by over 35% compared to Flash Player running in previous versions of IE.

Expect to find the greatest performance benefits when using bitmap heavy content. Flash content embedded as transparent (wmode=”transparent”) will also run more efficiently with the HTML and Flash composition being offloaded to the GPU.

It’s currently in beta but if you are using a 64-bit browser and would like to test your existing Flash content for compatibility and stability then head over to Adobe Labs.

Flash Apps? There’s a Phone for That.

No this isn’t another newspaper ad by the guys at Motorola. Apple has just done a complete U-Turn and are now allowing Flash apps back onto the App Store after having relaxed their app-developer restrictions.

I suspect Adobe are running around right now trying to get the iPhone Packager team back together again. I believe there’s a lot of unfinished work that got shelved after Apple’s original changes to the iOS Developer Program license.

I think the iPhone Packager is a great idea but it will need significant work if the majority of Flash developers are to get anything from it. Developing for mobile is a completely different ball game and it’s actually very easy to create Flash content that runs poorly on iPhone. I’m still hopeful we’ll see some great content from the Flash community, but I’m praying the weaker content that doesn’t show the platform off in a positive light gets weeded out by Apple’s App Store Review team.

If you’re interested in maximising Flash performance on iPhone then why not take a peek at my iPhone Render Performance Tutorial. It explains how to take advantage of the iPhone’s GPU and should help get you in the correct mindset for mobile development.

Exciting times once again for Flash developers. Although let’s hope Adobe don’t neglect the excellent work they’ve been doing on the Android platform.

Flash Websites? There’s a Phone for That.

I really like this Motorola Droid 2 ad that was printed in the Wall Street Journal the other day.

Considering most average users probably haven’t even heard of Flash it’s good to see the platform get a name check.

I found the dig at Apple quite amusing if not a little risky. Apple has such a loyal support that I won’t be surprised if it sparks a whole new round of Flash bashing.

Fingers crossed it doesn’t. Personally however I think the real battle Flash has to win is the tablet space rather than mobile. Many Flash sites just don’t work on such small screens. The larger screen real estate presented by tablets should help alleviate these issues somewhat.

Flash Camp Birmingham Postponed

Hopefully you’re all as lazy as me and haven’t actually booked travel and accommodation to Flash Camp Birmingham. Why? We’ll because it has been postponed that’s why.

Flash Camp won’t take place until 24th March 2011 now!!! That’s so far in the future we might all be living on the moon by then.

At least it gives me a bit more time to get organised enough to possibly attend.

If you think I’m making this up then hopefully this link to the Flash Midlands website will prove that I’m not.

Flash, Usability and the Mobile Web

A big congratulations to Adobe. Flash Player 10.1 is now available on the Android Market for Android 2.2 devices. Those planning to purchase new handsets such as the Motorola Droid 2 will be pleased to know that Flash Player 10.1 will come pre-installed allowing Flash content to work straight out of the box.

It’s a fairly modest list of devices at the moment with the Google Nexus One, HTC Evo 4G, HTC Desire, and Motorola Droid 2 initially receiving support. But as newer phones come to market and more existing handsets get upgraded to Android 2.2 we should start to see some significant Flash Player penetration.

I’ve had 10.1 installed on my Nexus One for a couple of months now and I’ve enjoyed having access to content that I wouldn’t normally be able to see on my phone.

I have noticed that the player’s performance has been criticised in some quarters and others have highlighted usability issues with existing content as reasons why everyone should ditch Flash/ActionScript for JavaScript.

Personally I believe these issues are mostly with the content rather than the Flash Player itself. I guess that’s always going to be the case when running content that was for the most part designed without mobile in mind and/or developed some time ago using obsolete versions of ActionScript.

The simple fact is there’s a lot of JavaScript heavy content out there that just doesn’t work well, or at all, on mobile either. I spent some time at the weekend trying out various JavaScript and HTML5 demos and found that most of them were completely unusable on my Nexus One (also tested on iPod touch and iPhone 4) due to either performance or usability issues (mostly both). That includes demos from popular HTML5 sites such as Canvas Demos and HTML5 Demos.

I’m certainly not trying to deride JavaScript or the excellent work that’s clearly going on in the community. I’m simply trying to add some perspective. It seems people are quick to criticise Flash when the exact same performance and usability issues on mobile have yet to be addressed by any other language.

I guess there’s so much Flash content out there that it makes it an easy target, but I for one am glad I now have a way of checking-out that content on mobile.

JavaScript and HTML5 will continue to march forward and replace many tasks that Flash was traditionally used for. My fear however is that developers will naively believe that using these technologies will somehow ensure their content will magically work on mobile. People need to realise that the user experience is very different on mobile and need to design with it in mind.

If we don’t then it won’t really matter what programming languages or virtual machines we eventually opt for.

I feel like I could take on the whole Empire myself

Wow! The last few days have been pretty amazing and I’d just like to thank everybody for the overwhelming positive response to my X-wing Targeting Computer app.

I’ve had desperate Star Wars geeks begging me to release it on the Android Market. Others have even resorted to threatening me with physical violence if I don’t 🙂

My original teaser post was a little vague – I honestly wasn’t expecting such a reaction – so I thought I’d take a little time to answer some of the questions that have been put to me via email or posted on the various sites out there:

Is it real or fake?
It’s real, although still in development.
Will you be releasing it on the Android Market?
Yes.
What version of Android will I need to run it?
Initially it will run on Android 2.2.
When will it be available?
It’s written using Adobe AIR for Android. I’m aiming to release the Targeting Computer app to coincide with the public release of AIR, which is itself still in development. Adobe has yet to announce a date but I’m hopeful that it won’t be that far off.
What about older versions of Android?
My priority is the Android 2.2 version but support for older versions of Android is a possibility.
What about an iPhone version?
What! You mean turn to the dark side? Actually I’m looking into it – wouldn’t want all you iPhone fans feeling left out.
Symbian, Blackberry, Windows Mobile?
Depends on time, resources and demand. If you want to see it on any of these platforms then please let me know. Come to think of it, it would probably look really good on the upcoming Nokia N8.
So are you a super nerd/geek yourself?
A girl I used to work with once said I reminded her of the Rain Man. I mistakenly took it as a compliment. Does that answer your question?
How much do you like Star Wars?
I paid to see the Phantom Menace nine times when it was originally released. I tried for a tenth viewing but unfortunately they stopped showing it at my local cinema before I had the chance. So yeah, I like Star Wars a lot. I prefer the original trilogy though.

I hope that has helped clarify things.

I’m sure a lot of you can now sleep more easily knowing that you’ll finally get the opportunity to know how it feels to be an X-wing pilot hurtling towards the Death Star’s exhaust port.

Until you do though, take it from me, it feels pretty damn awesome!