Category Archives: Flash

Adobe AIR Mobile: Application performance optimization on Android

When we talk about mobile development, we have to make sure our application is optimized as good as possible to run smooth on a wide variety of devices. Like Kevin Lynch said at MAX 2010, mobile development is like desktop/web development 7 years ago. Let’s take a look on how we can make sure that our mobile applications run smooth. I can already tell you that always a lot of testing (starting early in your development process) on different devices will be necessary to achieve the results you want.

When your application slows down on a device, it means that your code execution per frame or the rendering per frame or both is the bottleneck.

What to display in the DisplayList ?

Always make sure you use the right DisplayOject for the right job. As you know, a MovieClip uses more bytes then a Sprite and Sprite uses more bytes than a Bitmap…etc. When building up your DisplayList always keep in mind that the DisplayList really affects the memory usage of your application. If you have a set of Sprites on your stage for example, you can draw them in a BitmapData object and put that in a bitmap on the DisplayList. That approach will save some memory for sure!

When we talk about Bitmaps, we have to say something about the 2 Flash player render operations also. In the Flash Player every graphical element in your application is rasterized inside a bit/pixel buffer (=rasterizing) and those tiles of pixels are then arranged to make up your scene (=scene compositing) in the main pixel buffer (what you finally see on the device). Every frame, the player calculates a dirty region (=the redraw regions) to see what must be rasterized again and merged again in the main pixel buffer. All those tasks are done by the CPU when doing web/desktop development but with Adobe AIR 2.5 targeting mobile devices, you can choose if the CPU or the GPU needs to do those important tasks.

CPU/GPU rendering

At this moment on IOS, a ‘special’ GPU mode is only supported, it is called GPU Blend. This means that the task of the the creation of the different pixel buffers is done by the CPU and then the CPU sends it to the GPU. The GPU finally does the scene compositing.

On Android, when you use GPU rendering, this is called GPU Vector, the tasks are done fully by the GPU. So, the creation of individual pixel buffers and the scene compositing, it all happens at the GPU. This can give you a huge performance boost. But can we make sure we are using GPU rendering?

That is where bitmap caching comes in.

Read more of this post

Advertisements

Recording Video with Adobe AIR 2.5 on an Android device

In this example we will develop a simple mobile AIR application that let the user capture some video with the built in Camera application, and bring the video back into the AIR application. Accessing one camera is a cool new feature in Adobe AIR 2.5.

Setting up your working environment

What I really like about Adobe AIR 2.5 mobile development is that the tools (Adobe Flash CS5 or Flash Builder Burrito) give you the possibility to immediately test on a real USB connected device. At adobe MAX 2010 a few weeks ago we all got a brand new Motorola Droid 2 device so that will be my testing device. When I first played with the telephone I had some problems in running the pre- installed AIR applications. It seemed that in some way the Adobe AIR plugin was not correctly installed. But no problem, I went to the Android market, downloaded and installed Adobe AIR again. Then I was able to run the installed AIR applications (Gravity Lander, GridShock,…) which is cool.

So first step is to make sure your mobile device runs Adobe AIR 2.5. You can install AIR 2.5 on Android devices running Android 2.2 (Froyo).

Next step is to make sure that your device is connected to your computer. For more information on connecting your Android devices to your computer look into this guide:   Connect your Android device to your computer

You also have to make sure that your mobile device is configured well. You have to set USB-debugging on, turn off mass storage mode and enable charge mode. For more information also go to the above URL.

Next step is to check that  your mobile device is on the same wireless network so it is able to connect to the debugger. If you are on Windows (7, Vista, XP) make sure to disable your firewall because port 7935 must be open to make a connection between your device and your computer. Also install the necessary USB driver for your mobile device. There are some USB device drivers preinstalled when you install Flash Builder Burrito (Google Nexus One, Motorolla Droid, HTC Incredible,…)

Checking if CameraUI is supported

Let’s go ahead by setting up a new ActionScript Mobile Project in Flash Builder Burrito and in the document class we have to  check if our device actually supports the Camera. It is a best practice that when  you use specific features of a mobile device you always do a check first to see if that feature is supported.

Read more of this post

Adobe UserGroup Meeting + BBQ

It’s becoming a tradition, every year in september the AUG Belgium organises an inspirational event and a BBQ afterwards. This year the magic is all going to happen on September 12th. This meeting is powered and hosted by Combell, your host on the internet !

This meeting will focus on Flash and ActionScript and speakers this year are : David Lenaerts , Seb Lee-Delisle and Niqui Merret.

The schedule looks like this:


16:15 : Welcome

16:30 – 17:15 : Off the beaten path (David Lenaerts)

In this session, David will walk through some of the experiments and projects he has done over the past year while elaborating on the concepts behind them. Without getting too technical, he will explain his motives, his love affair with Pixel Bender and the big looming question: “Mmkay, but what’s the use?”. Using experimentation as the main thread, he will try to show how going off the beaten path can take you to sweet little places you didn’t expect, and finally, offer a sneak-peak at some of the more useful projects I ended up doing as a result.


17:45 – 18:30 : bug squashing in foreign environments (Niqui Merret)

She was the point man for Bugfixers XXIV Flash Corps and had been leading the line since God knows when. She knew well that in the jungle of other people’s ActionScript the canopy is so thick that the light only filters through in pale shafts. She took a step forward, the muddy nook sloshed against her thighs. Forgotten slicks of AS2 napalm drifted across the surface, burning fresh sores into old wounds. Malarial clouds of timeline Cong Moui swarmed and bit.

Flash bugs – Charlies, Vietcong, whatever you wanted to call them – she could smell them coming. She showed a flat palm to the slack man behind and the whole line came silently to a halt. She’d been through so many old FLA’s and undocumented hacky AS Classes, that everyone knew they could trust her implicitly. She knew Charlie like he was family and nothing was going FUBAR on her watch.

“Charlie code” she whispered “bites you motherfucking rookies in the ass. But not me, I prioritize, and know enemy code bases inside out. You better listen to me unless you plan on flying home in a body bag. DO NOT hunt Charlie in circles and make sure you document your goddam area for the marines following you up, you understand me newbie? Stick with me and I’ll show you how it’s done.”

A band of Vietcong burst out on the starboard side. “Strike those down” screamed Merret, and turned her Tommy on the Bugs.


18:45 – 19:30 : Work / Play (Seb Lee-Delisle)

Seb shares his experience on the Papervision3D team and as head geek at Plug-in Media putting the fun back into digital, whether through Flash games, projects that involve the wider digital community, or public art installations (like the interactive digital fireworks). For more information about Seb and his work see pluginmedia.net/portfolio and sebleedelisle.com.

19:30 – … BBQ and drinks !

I am really looking forward to it and hope to meet you all there for a really great event ! REGISTER NOW HERE