1

I have a Flex Library Project which has both Flex specific classes, and Air specific classes.

When I reference the library in an Air project, the compiler complains about an overriding contextMenu in mx.containers.Panel, saying that the param should be of type NativeMenu (instead of ContextMenu). If I switch it over to NativeMenu then it compiles fine.

The issue is when I reference the library in a Flex Project. This time it complains that it doesn't know the type NativeMenu. If I try to change it back to ContextMenu, then I get the same error as above.

I've searched google to no avail (found that someone else encountered the exact same problem: http://forums.adobe.com/thread/598791?tstart=-1 )

The docs don't help too much either, except stating the above: http://livedocs.adobe.com/flex/3/langref/flash/display/InteractiveObject.html#contextMenu

I'm thinking that its just not possible to do the mixing of Flex vs Air SDKs that I want, but I was hoping that maybe someone has figured this out.

Thanks!

gmoniey
  • 7,975
  • 4
  • 27
  • 30

2 Answers2

0

You can't really target the web Flash Player and the desktop Player using the same project.

I would recommend encapsulating out as much functionality as possible into a library project. Then create a single Flex project and a single AIR project, both using the same library project.

Each respective project can extend, or replace, the different functionality.

JeffryHouser
  • 39,401
  • 4
  • 38
  • 59
  • Thanks for your response. The issue with your suggestion is that sometimes it defeats the purpose of the Library. In my case, the library contains some common code dealing with Air only NetworkInfo classes. The NativeMenu is an unfortunate byproduct. – gmoniey Jul 13 '10 at 20:51
  • The purpose of a library project is to share code between multiple projects; I'm not sure how my suggestion defeats the purpose of a library. From a logistic standpoint, a library that you want to use for web based Flex applications should not include any AIR specific code. Just like a library you want to use in Flash Pro shouldn't include any Flex specific code. – JeffryHouser Jul 13 '10 at 21:15
  • I think that maybe my initial explanation was not completely clear. My issue is that the Library has the Air & Flex code. When the Library is used in an AIR project, everything is fine. When the Library is used in a FLEX project, I get the error above. Unfortunately, in my case, moving the functionality down to the Library is what has caused this issue. – gmoniey Jul 14 '10 at 21:11
  • Yes, if you try to use an AIR Library in a Flex project, you should expect an error. Either move the AIR code out of the library into the main AIR project, or move it into a separate library. You can also daisy chain libraries if you wanted. – JeffryHouser Jul 14 '10 at 21:23
  • I split up the library code, but it turns out that the issue is with the AIR SDK. It requires NativeMenu in the override, but of course, the Flex project can't find this class. Seems like a bad implementation on the SDKs – gmoniey Jul 15 '10 at 05:11
0

I am not sure if this is the exact same problem, but I was having an issue with being able to reference the AIR libraries in a Flex Library project and found the (rather simple) solution.

Using Flash Builder 4.5, when creating a Flex Library Project, (right-click .. New.. Flex Library Project) there is a checkbox for "Include Adobe Air Libraries" at the bottom. This must be checked or AIR libraries will not be included.

When you select the version of SDK/AIR you are using in the dropdown, the message should also indicate what the minimum version of AIR required is for your application.

Michael
  • 3,269
  • 2
  • 23
  • 16