views:

36

answers:

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!

A: 

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.

www.Flextras.com
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
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.
www.Flextras.com
gmoniey
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.
www.Flextras.com
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