user1157092
user1157092

Reputation:

Porting a mobile Flex/ActionScript application to run on the desktop

Has anyone tried to port their mobile ActionScript/Flex application to run on PC/Mac as well? The problem is that Flex has some mobile only classes and other classes not recommended for mobile.

I have not yet tried to do this, and am wondering if others are willing to share their experience with this problem. It seems like there are a few possible ways to do this that might work.

1) It might work to include mobile-only libraries in the desktop version of the app in order to use as much common code as possible.

2) It might work to refactor each view component into a container part for mobile, a container part for desktop, and an inner part that contains all of the controls, which is used for both mobile and desktop.

3) It might work to write Flex out of the application, and have a pure ActionScript application. This would require writing my own replacements for View, ViewNavigator, and TabbedViewNavigator in ActionScript and replace all spark.components with fl.controls. (I have already eliminated data binding and states from the mobile application for performance reasons).

Upvotes: 1

Views: 332

Answers (1)

JeffryHouser
JeffryHouser

Reputation: 39408

Has anyone tried to port their mobile ActionScript/Flex application to run on PC/Mac as well?

Yes, I did it with my mobile game. Also in demos of the mobile Flextras Components.

It might work to include mobile-only libraries in the desktop version of the app in order to use as much common code as possible.

IF you want to use mobile components in a non-mobile project; this is the approach. Add the mobile only SWC into your library path. You may also need to add the mobile theme to your library path to. This can be tedious, though, as then you'll have two themes and it may introduce issues with shared components; such as a List or scroll bar, that need a full theme specified.

It might work to refactor each view component into a container part for mobile, a container part for desktop, and an inner part that contains all of the controls, which is used for both mobile and desktop.

For the main screens on my mobile game; I made the view content extend a group. Then I wrapped them in a 'view' on mobile or a group for the browser.

I'm unclear what problems your third suggestion would solve.

I also suggest moving as much code as possible into library projects so that they can be shared between your desktop, browser, and mobile projects.

In my mobile game, I have a "Flex-less" library for the game board. Then I have a Flex Library project for the view content. This library 'wraps' the game board. Then I use the Flex Library in a mobile project and in a web project which puts all the pieces together.

Differences exist in how the level data is loaded (Using File Class on mobile, and URLLoader in web). I set properties on the views to control various aspects. For example, the browser based version of the game hides the on-screen controls because I assume people will be using the arrow keys.

Upvotes: 2

Related Questions