views:

666

answers:

4

I'm not using the Flex libraries or anything from Flash. I'm developing a pure AS3 project in Flexbuilder which I would like to deploy as an AIR application.

What are my options? What's easiest? I'm having trouble finding a straight answer here.

+1  A: 

You can use either Flash or Flex to create your AIR app. Which is easier depends on the nature of your app. If your app is fairly complete as it is and won't change much going forward and you are just concerned with turning it into an AIR app, you can use either.

I do like the availability of a command-line compiler (i.e. mxmlc from Flex) as I can use automate the build process more easily. With Flash, you will need the IDE to compile the app. Also, once you get into making it an AIR app, it's highly likely that you might run into things that can be done much faster in Flex than in Flash due to the framework code that you can leverage. So Flex is a better way to go overall.

Boon
Again, I'm talking a pure AS3 project in Flexbuilder. I'd like to use some of the AIR functionality, but have no particular use for the Flex libraries. As such, I'm not sure of a way to build the project as an AIR project without converting the project into a Flex project and thereby including the Flex libraries... which again I don't need.
grey
In that case the your best option is to build your app with Flash CS4 as then you won't be forced to linked against the Flex framework library.
Boon
Out of curiosity, is there an alternative that allows me to build my project without the Flash IDE or integrating the Flex library while still accessing AIR's libraries?
grey
Yes, you can do it with the command line compiler amxmlc. http://livedocs.adobe.com/flex/3/html/help.html?content=CommandLineTools_2.html#1043794
Boon
Thanks. That looks like the thing I wanted to see but couldn't find. As a last clarification, is it possible to automate that process from within Flex thereby avoiding going to the commandline during testing?
grey
You should be able to do it, but I have never tried. In the Flex IDE, if you go the project properties where you can set the library path, you can try removing the flex lib there. That might just allow you to build your AIR app without compiling Flex into your project. Try that out and see what happen.
Boon
A: 

To do this in FlexBuilder you simply create a Flex Project AIR application in Flexbuilder like you would normally, then in the 3rd step where you define extra source and library paths, change the suffix your .mxml file to .as, ie so Main.mxml becomes Main.as.

Another obvious gotcha for Mac development is the pesky ADL files not quitting when you close the air app...I use the OSX Activity Monitor to manual force quit the adl file after closing my air app.

eco_bach
I tried just making it an AS file, but when I run it ADL launches with no window. Are any other steps necessary?
grey
+1  A: 

Here is a more complete answer...

As unknown stated above:

"To do this in FlexBuilder you simply create a Flex Project AIR application in Flexbuilder like you would normally, then in the 3rd step where you define extra source and library paths, change the suffix your .mxml file to .as, ie so Main.mxml becomes Main.as."

That runs, but shows nothing... for some reason this doesn't automatically instantiate a native window. From Laurentie Adobe Bug Systems:

"Of course after the project is created i add code to create the windows and stuff, but that wasn't the issue, so i involuntarily ommited that. :)

try something like:

var options:NativeWindowInitOptions = new NativeWindowInitOptions();
//options.systemChrome = "none";
//options.transparent = true;
var mainWindow:NativeWindow = new NativeWindow(options);
mainWindow.activate();

and you add content to that window throught mainWindow.stage. :) hope that helps"

All of that being said this isn't really an ideal solution. But there it is for those of you who want to experiment.

grey
+2  A: 

That runs, but shows nothing... for some reason this doesn't automatically instantiate a native window.

rather than creating a new window that doesn't represent your main application, simply call stage.nativeWindow.activate(); in your main application class.

That's sounds useful. I'll check that out too.
grey
Just saw this again here:http://www.danielhai.com/blog/?p=70And reminded me that I had asked this. Thanks again!
grey