Review: Flash Development for Android Cookbook

With Android’s growing momentum, the Flash platform is perfectly positioned to allow developers to take advantage of its runtime to distribute content across mobile. Part of Packt Publishing’s popular Cookbook series: Flash Development for Android Cookbook by Joseph Labrecque offers over 90 carefully selected recipes for demonstrating mobile concepts related to Android and providing step-by-step practical examples.

While knowledge of ActionScript 3 is a requirement, even beginners should be able to grasp most of the concepts covered and easily lift the code examples straight from the book into their own projects. Impressively, the reader isn’t restricted to a single IDE. Instead many popular options are covered, with time spent in the opening chapter detailing how to configure Flash Professional, Flash Builder and the popular Powerflasher FDT. And while its focus is predominantly on pure ActionScript, the author also finds time to cover the Flex framework where appropriate.

With your development environment set-up, attention turns to your Android handset and the basics of device interaction. A series of concise and straightforward recipes highlight how to take advantage of multi-touch, gesture support, the virtual keyboard, and any physical keys found on the device. For anyone used to development for desktop, the content covered here will help get you in the correct mindset for targeting mobile.

Android devices also feature a wide range of sensors, and the book spends many chapters exploring those that are accessible from Flash. The geolocation sensor is covered and examples of it being used in conjunction with with a third-party API are given. Unfortunately the API chosen was Google Maps, which has now been deprecated. Nevertheless, it does illustrate the point and the techniques can easily be transferred to alternative services.

Valuable time is also spent covering the accelerometer, including how to detect changes in the device’s orientation. The difficult subject of screen layout is also addressed, with examples highlighting how to adapt your application’s layout in response to orientation changes. Some recipe’s demonstrating the strength of Flex for such tasks are also given, which is a useful insight for those who aren’t familiar with the framework.

Probably the most popular sensors on any mobile device is the camera, and the cookbook shows how to capture both still images and shoot video. As well as Flash’s traditional camera support where video is rendered directly within your application, the reader is also shown how to launch the device’s native camera app to perform these duties. When targeting Android, it’s important to deliver a consistent experience to the user by presenting them with familiar native apps for such tasks, and this is successfully highlighting. Loading images from Android’s Camera Roll app is another example of this.

Both video and audio, in general, are well catered for. In addition to capturing video, there are plenty of examples showing how to playback both local and remote video. Streaming video from a Flash Media Server is also included. There’s even room to explore microphone audio capture and the generation of sound at runtime. Unfortunately hardware accelerated H.264 video playback, which is new to Flash, arrived just a little too late to appear in the book, which is shame as it’s a great feature.

The format, allows you to dive right into any subject you like, with the majority of recipes being independent from one another. This makes Flash Development for Android Cookbook a resource worth keeping close at hand during development. You’ll find yourself frequently turning to it, either to serve as a reminder or to learn something new. While it might not always go into the greatest detail, what we have is a wide coverage of what Flash has to offer on Android. You’ll find that after each recipe you’ll be in a good position to go on and seek any further knowledge you require.

A very easy and concise read. I highly recommend this book to any Flash developers wishing to explore Android development.

You can purchase Flash Development for Android Cookbook from amazon and the Packt Publishing website.

Concurrency in Flash

One of the most frequent requests for the Flash runtime has to be the ability to leverage multi-core architecture using ActionScript. Well as you can see from the video below, concurrency is coming to ActionScript.

The hour long session covers quite a lot of ground and shows code examples of the new ActionScript worker API in action. Of course, multi-threading already exists in the runtime via the many asynchronous ActionScript APIs; plus Flash’s rendering pipeline is also multi-threaded. However, this will be the first time that developers will actually be able to execute their own code on background threads. It will also be possible to render to the display list from your threads, which is quite an exciting new feature.

Happy Halloween

Get Adobe Flash player

I thought I’d create some spooky ghosts using Starling to scare my WeeMee with. Enjoy Halloween everyone!

Starling Experiment

I’ve been playing with the Starling framework and so far the performance on desktop has been pretty good. Here’s a little experiment I bashed together.

Get Adobe Flash player

Just click on the little rotating sprite then watch all hell break loose. Oh and once things get a bit hectic, run your mouse over them to create some nice effects.

Vlad’s Vampire Bats

The Flash platform has had some success with children’s interactive books and here’s another one that’s arrived just in time for Halloween. Vlad’s Vampire Bats tells the story of Vlad; a lonely vampire with a problem: everything he touches turns into a bat. You’ll be taken through 17 screens of animated fun, lighting candles with your finger, exploring Vlad’s castle, and of course, turning things into bats!

Interestingly Vlad’s Vampire Bats was created by a design team who had no prior programming experience. The guys at Frosby Designs learned ActionScript 3 from scratch in order to put the app together, which is a great testament to the strengths of the Flash platform.

Sounds like fun but I’m obviously a little too old for this app so I decided to see how wee Freddy, my one year-old nephew, would respond to it. Well you’ll be pleased to know he laughed his little head off and constantly slapped my iPad’s screen with delight so I’m guessing Frosby got this one just about spot on. Great stuff!

Vlad’s Vampire Bats is available for iPad, iPhone and Android.

It’s Not All About 3D You Know

Yup, that’s right. With all this talk of Stage 3D lately you could be forgiven for thinking that Adobe has given up on simple 2D games. However that couldn’t be further from the truth. It may not be obvious from its name, but the Stage 3D APIs are also perfect for rendering high-performance 2D graphics.

What? You don’t believe me? We’ll why not take a look at the Starling framework. It’s an ActionScript 3 API that harnesses the power of the GPU to produce 2D rendering performance never before seen in the Flash Player. I know what you’re thinking; it all sounds pretty complicated and scary but it really isn’t. Starling’s API closely follows Flash’s native display list classes, allowing you to quickly get to grips with it. You’ll be moving thousands of sprites around the screen and dazzling friends with impressive particle effects in no time all all.

What’s more, Starling is a direct port of the Sparrow Framework, which is a native iOS library. This is great news as it means you’ll have the potential to write blazing fast mobile games too! After all, Sparrow has proven itself in the field and there’s no real reason why Starling won’t perform similarly once ready for iOS. And while many of you will probably be eager to get your teeth into 3D, don’t forget that simple 2D games are not only cost effective but are typically more accessible. Just take a look at Angry Birds or Tiny Wings.

It’s still early days for GPU acceleration in Flash but I’d encourage you to start experimenting. And Starling isn’t the only 2D framework; there’s also ND2D, which is looking similarly impressive.

Unreal Engine 3 and Alchemy

The announcement of Unreal Engine 3 for Flash Player 11 was huge and goes to show just how powerful Stage 3D is. If you’re in any doubt about the potential of Flash Player 11 then just take a look at the video below, showing a technical demonstration of Unreal Tournament 3 running in the browser.

But the hardware acceleration of Stage 3D isn’t the only thing worth getting excited about. You ever thought about how they actually ported Unreal Engine’s source code to Flash? After all, re-writing just over a million lines of code in ActionScript 3 just isn’t practical. Well the conversion was achieved using Adobe Alchemy, which enables the conversion of C and C++ code into high-performance ActionScript bytecode. If you want to know more then take a look at this great insight into Alchemy presented at Adobe MAX.

So there you have it. Flash is now capable of delivering a high-quality console gaming experience directly within the browser. And if you’re considering writing 3D games content for the platform then you really can’t get any better than the Unreal Engine.

I’ll leave you with a quote from Epic Games’ press release:

UE3 is constantly evolving, with new breakthroughs, technologies and optimizations for multiple platforms. Flash Player 11, with its hardware accelerated, programmable graphics pipeline, is now capable of running triple-A gaming content authored for high-end platforms using the industry’s latest tools and technologies.

Learn AS3 for Free

So I think you’ll agree that ActionScript has come a long way since its humble beginnings as a simple scripting language for controlling timeline animations. However, while each new version of the language has been accepted with open arms by developers, creatives have been less willing to embrace it. This is a terrible shame, because it’s the incredible work by all you animators and illustrators out there that put Flash on the map in the first place.

So if you’re still tinkering with ActionScript 2, or even 1 then you might be interested in Hoss Gifford’s free ActionScript 3 training course. It’s taking place in Glasgow on the 24th and 25th of November and is aimed squarely at people who currently throw smatterings of ActionScript onto the timeline.

I had the pleasure of working with Hoss a few years back and he’s one of those rare breed of people who has mastered Flash from both a programming and creative perspective. He’s also an exceptional communicator who’s spoken at various conferences all over the world. What I’m trying to say is this. If anyone can teach ActionScript 3 to non-programmers, it’s Hoss. Do yourself a favour and sign-up for it. And hurry, there’s limited space.

Oh and did I mention that he’ll have you write a game and stick it on iPad, iPhone and Android by the end of the second day? Exciting eh!

And yes, I did say it was free.

Inferno for Xbox 360

My buddy Alex is probably the best programmer in the world! He has a particular passion for all languages containing the letter ‘C’ and he’s so good that he bashes games together during his lunch breaks! And here’s one of them. Inferno is Alex’s first Xbox 360 game, which you can pick up from the Xbox Live Indie section. It’s a port of an old 8-bit game so if you like your retro arcade stuff then it should be right up your street.

Oh and if you’re wondering what this post has got to do with Flash then the answer is pretty much nothing. But then again I did have a conversation with Alex the other day and he reckons that Flash is the perfect platform for bashing together Android apps. In fact, he’s considering porting Inferno to Android using it. So there you go.

Steve Jobs 1955-2011

I’ll be honest, Steve Jobs’ criticism of Flash and the subsequent banning of apps built using Adobe’s Packager for iPhone enraged me and for quite some time turned me away from Apple products. Such was his reputation and authority that his words were able to polarise even those within the Flash community, with some jumping ship the moment he declared the technology as good as dead. In fact, he did more to diminish Flash’s presence as a web technology than HTML5 ever could on its own!

I say this only to highlight the respect he’d earned and rightfully so. When Steve Jobs spoke, people listened. While others copied, Steve Jobs innovated. The iPhone was a paradigm shift and it couldn’t have happened without him. He had that rare ability of being able to take the complex and make it simple, so that almost anyone could understand and use it.

Even after several years of playing catch-up, it’s clear that the rest of the industry still doesn’t really get it. Manufacturers churn out device after device, desperately trying to recreate Apple’s success story. These devices might very well resemble iPhones and iPads. They may even have superior technical specifications. But rarely do they ever come close. Steve Jobs understood that it wasn’t just about the hardware, but the user experience. That was where the real magic happened.

So what now for Apple? Will they continue to grow and innovate or will they slide back into the abyss that Jobs saved them from? It’s hard to tell what the long term holds for them, but in the short term I think Steve Jobs ensured that the right people were in place to continue his vision. And if you’re in any doubt about that vision just think back to the clunky handsets we were all using before the iPhone arrived. Without Steve Jobs kick-starting the industry, we’d probably all still be obliviously struggling with them right now, unaware that a brighter, better, and more entertaining future was a possibility.