Since I got
my Hero I've been meaning to do some Flash testing on it.
So I downloaded the
Android SDK, installed
ADT (plugin for Eclipse), briefly read the docs, compiled a couple of Hello World apps and I was finally all up and ready for some
serious business.
Or so I thought.
Testing Flash apps on the Hero is not that easy and information is
very scarce. I've asked in a
couple of
places and heard nothing back.
To begin with, you can't test Flash apps on ADT's emulator. This is most likely because the Flash player that the Hero runs is
not part of Android, is a propietary HTC application.
Then, I haven't been able to launch the Flash player on the phone directly. You can see it when you list the applications (Settings > Applications > Manage applications > HTC Flash player) but there's no human way to launch it.
Also it doesn't seem possible to open a SWF on the SD card with the player. NOTE: if you are missing a file manager on the Hero, welcome to the club. I had to install
ASTRO, it seems to do the job.
Opening a HTML page on the SD card with a SWF embedded doesn't work either, it seems
plugins on local pages have been disabled.
Luckily for me several of my Google Reader contacts shared a post by Mark Doherty about
Flash development with Android SDK where he explains how to create an Android app that will launch the Flash player. And so I did. I've added it to my
ZCode repo in case you might need it (
direct download).
Please note that the Android app runs on landscape only. I think the app simply not listens to the orientation change event and thus is locked in landscape. I have to look into this.
So, what we have left? Oh yes, the best method so far which is connecting your Hero to the same network as your main computer via WiFi, run a local web server and access the content from the Hero's browser itself. You don't even need a HTML page, you can point the browser directly to a SWF file and it will play it full screen straight away.
Now we can do the serious testing:
* As opposed to when run inside the Android app, when run from the browser the SWF plays normally in both portrait and landscape. You can set yourself as a listener to the Stage and implement the onResize method as usual. The Hero reports 314x480px in portrait and 474x320px on landscape (although is running fullscreen all the time and there's no apparent size difference).
* A home made FPS meter returns a steady 31fps rate for an empty movie.
*
There is no drag support. I think this is very bad news and something I'm sure Adobe/HTC are going to fix soon. The problem is that when you touch and hold your finger the player completely stops. I realized this because I had an onEnterFrame updating a clip's x,y values based on the cursor position and the trace just stopped when I left my finger on the screen trying to drag the clip around. No code was being executed. This means at the moment you can't build an IPhone like touch & drag interface.
Now I want to test performance tweening clips all over the interface, some real world apps and most interestingly how could a Flash app embedded in an Android app talk to it. Yes, the idea is allowing Flash apps access the same APIs as native apps.
That'd be cool : )