Flex 库项目:NativeMenu 与 ContextMenu
我有一个 Flex 库项目,其中包含 Flex 特定类和 Air 特定类。
当我在 Air 项目中引用该库时,编译器抱怨 mx.containers.Panel 中存在重写 contextMenu,并指出参数应为 NativeMenu 类型(而不是 ContextMenu)。如果我将其切换到 NativeMenu 那么它编译得很好。
问题是当我在 Flex 项目中引用该库时。这次它抱怨它不知道 NativeMenu 类型。如果我尝试将其更改回 ContextMenu,则会收到与上面相同的错误。
我搜索谷歌无济于事(发现其他人遇到了完全相同的问题: http://forums.adobe.com/thread/598791?tstart=-1 )
除了说明上述内容外,文档也没有太多帮助: http://livedocs.adobe.com/flex/3/langref/flash/display/InteractiveObject.html# contextMenu
我认为不可能混合我想要的 Flex 与 Air SDK,但我希望也许有人已经解决了这个问题。
谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您无法真正使用同一个项目来定位 Web Flash Player 和桌面 Player。
我建议将尽可能多的功能封装到库项目中。然后创建一个 Flex 项目和一个 AIR 项目,两者都使用相同的库项目。
每个项目都可以扩展或替换不同的功能。
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.
我不确定这是否是完全相同的问题,但我在能够引用 Flex 库项目中的 AIR 库时遇到了问题,并找到了(相当简单的)解决方案。
使用 Flash Builder 4.5,创建 Flex 库项目时(右键单击..新建..Flex 库项目)底部有一个“包含 Adobe Air Libraries”复选框。必须检查此项,否则将不会包含 AIR 库。
当您在下拉列表中选择正在使用的 SDK/AIR 版本时,该消息还应指示您的应用程序所需的最低 AIR 版本。
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.