We have a client with a Flex-based web site that serves up FLV videos. For some time, he’s been looking to move into the mobile market, so when Adobe announced that Flash Builder 4.5 now supports mobile development in Flex, it seemed like it could be a perfect fit. So I developed a proof-of-concept — a mobile app that retrieves a list of videos from a .NET web service, allows the user to select a video, and plays it.
The basics of getting a mobile application up and running with Flex were pretty straightforward. For a good tutorial, check out http://www.adobe.com/devnet/flex/articles/twitter-trends.html.
From the above tutorial, you can see that it’s easy to get data from web service and bind it to an <s:List> which takes care of the display. I used the same .NET web service that feeds the web site. I did need to make sure the HTTP POST verb was enabled, since Flex didn’t seem to have a SOAP option.
When the user taps a video in the list, it switches to a view that displays the video. It took me a while to figure out the best object to use to display the videos, and how to handle orientation changes, but once I figured out what I was doing, it was very simple. Here’s the entire code listing for the view that shows the videos:
That’s it! Currently, only Android is supported, but iOS and Blackberry PlayBook are coming soon. An Adobe evangelist has already developed a Flex app that works on iPad using an engineering build (see http://coenraets.org/blog/2011/03/flex-on-the-ipad/), so iOS support shouldn’t be too far off for the rest of us developers. I’m pretty excited about Flex as a possibility for cross-platform mobile development.Tags: Android, Flash, Flex, Mobile