2

I have a flex component that is using mostly mx and actionscript code. I am using it fine in my AIR application, however, I need to be able to use certain Air libraries within this component, so I need to make it Air 'aware' or compatible.

For example, I need to get a reference to the current active window, so it looks like I need to use NativeApplication.activeWindow.

But when I type this in to my component actionscript class, it does not know about NativeApplication. So it seems I have to do something to that project to enable Air classes, unless there is another approach?

Scott Szretter
  • 3,938
  • 11
  • 57
  • 76
  • Think your best bet is to just create a new blank project choosing to start with an AIR project then copy your code into the new project. Otherwise you need to manually add in the correct swcs for AIR compilation and you need to write up the app-descriptor xml file, seems like it'd be easier to let the tool generate that for you and just copy over the src. – shaunhusain Jan 31 '12 at 18:34

2 Answers2

0

Need to import the libraries into your code like this:

import flash.display.NativeWindow;
import flash.display.NativeWindowSystemChrome;
import flash.display.NativeWindowInitOptions;

Then the application can use it.

ShaunOReilly
  • 2,186
  • 22
  • 34
0

Do you use Flash Builder and Flex Library Project to compile your component? If yes, there is a checkbox "Include Adobe AIR libraries" in the project properties. Open Project > Properties > Flex Library Compiler and check "Include Adobe AIR libraries".

ira
  • 63
  • 7
  • This works, but just as a note, I have found that most of the time creating a new air project is the best bet and then move the source files in to that. A lot of times projects might have other buried settings that are not compatible, and creating a new project seemed to be the quickest solution. – Scott Szretter Mar 24 '12 at 13:25