0
votes

Everyone wants to compile their desktop (AIR) or web (Flex) applications as mobile (Air mobile) apps. Here I am going on the opposite direction. I want to compile my Air mobile app as a Flex web app and open it with the browser.

I think this is possible since, at the end of the day the, the Air mobile framework is -almost- a subset of the flex framework. Am I correct? I know that you use other libraries as well, like mobilecomponents.swc and servicemonitor.swc, but mainly they are supposed to be very similar.

While trying to acomplish this, I created a Flex Project on the Flash Builder and added the mobilecomponents.swc, imported my mobile code and replace and compiled it. There were no errors and the builder compiled everything without any warnings.

The only problem was that when I opened the swc in the explorer, the screen was all white and the app didn't even run. I knew the swc was loaded because of the mouse context menu, it showed you all the options of a regular swc but the app didn't run. I tried to debug it but nothing happened.

Clearly I did something wrong. If anyone can tell me how can I do this, I would really appreciate it.

Thanks in advance,

Sebastián

2

2 Answers

1
votes

I've done it before so it should work just fine.

What I did was create a standard web app (I have no code in sitting in "main" so I could switch the top level application tag easily), added mobilecomponents.swc, and selected the mobile theme in the Project Properties (you may need to import this from frameworks/themes/Mobile/mobile.swc).

After that it should be able to use the mobile components in a web or air desktop build.

3
votes

You're confusing some things...

I want to compile my Air mobile app as a Flex web app and open it with the browser.
I think this is possible since

You are correct; this is possible. I converted a mobile application to a browser based application in about half a day. I had to change how a config file was loaded; but everything else worked without change.

You may have to re-write some functionality of your app if it uses AIR Specific functionality. The File class is one example.

the Air mobile framework is -almost- a subset of the flex framework. Am I correct?

You are wrong here. The AIR Mobile framework is completely independent of the Flex Framework. However, the Flex framework does provide many mobile optimized skins for Flex UI Components, such as buttons and lists. It also provides some special mobile only components.

However, there are non-Flex classes / functionality available on mobile that have nothing to do with the Flex Framework; they are part of the core AIR SDK provided by Adobe. The File class I mentioned previously is one.

While trying to acomplish this, I created a Flex Project on the Flash Builder and added the mobilecomponents.swc, imported my mobile code and replace and compiled it. There were no errors and the builder compiled everything without any warnings.

Yes, you can use the Flex Mobile Component set tin a browser based app or other desktop app. But, as you discovered, you have to manually add the SWC to the output. You may also need to add the mobile theme for the mobile components to display properly. This can get confusing if you want to use a mix of mobile themes and non-mobile themes in the same app; because there is some cross over and Flex will not know which one to use by default.

You'd have to provide more information / code to help us diagnose the specific error you received.