bar

Mobile Flex Development with Flash Builder 4.5

Posted on: May 23rd, 2011 by Chris Hooker 2 Comments

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: , , ,

2 Responses

  1. Ben says:

    “It took me a while to figure out the best object to use to display the videos…”

    What component are you using to display your videos on the mobile application? I have been trying to use the VideoPlayer component, but there are issues when sizing and maximizing/minimizing. What component do you believe is the best one to use for video playback?

    • Chris Hooker says:

      I’m using the Spark VideoPlayer component. What kinds of sizing problems are you having? My videoView_resizeHandler function seemed to handle orientation changes without problems, but that’s the only resizing I’m doing. Are you having problems on the desktop, or running on a device?

Leave a Reply