“QNXApplication.qnxApplication.addEventListener”上出现错误
我想在我的 qnx 视图上创建选项菜单,我正在使用 Air SDK,我得到了这个示例
<?xml version="1.0" encoding="utf-8"?>
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="createMenu(event)"
firstView="views.testHomeView" xmlns:utils="utils.*">
<fx:Declarations>
</fx:Declarations>
<fx:Script>
<![CDATA[
import caurina.transitions.Tweener;
import mx.events.FlexEvent;
import qnx.events.QNXApplicationEvent;
import qnx.system.QNXApplication;
// Registers the drop down menu for PB application
protected function createMenu( event:FlexEvent ):void
{
QNXApplication.qnxApplication.addEventListener( QNXApplicationEvent.SWIPE_DOWN, pullDownMenu );
}
private function pullDownMenu( event:QNXApplicationEvent ):void
{
trace( "Menu pulled down" );
Tweener.addTween(slideMenu, {y: 0, time: 0.5, transition: "linear"});
/**
* add the mouse listener to hide the menu when the user clicks
* outside of the menu area
*/
stage.addEventListener(MouseEvent.CLICK, onStageMouseClick);
}
// Hide menu when the screen is touched outside menu
private function onStageMouseClick( e:MouseEvent ):void
{
/** if the user clicks outside of the menu area, hide the menu */
if (mouseY > slideMenu.height)
{
Tweener.addTween(slideMenu, {y: -slideMenu.height, time: .3, transition: "linear"});
stage.removeEventListener(MouseEvent.CLICK, onStageMouseClick);
trace( "Menu went up" );
}
}
]]>
</fx:Script>
<s:navigationContent>
<utils:Menu id="slideMenu">
</utils:Menu>
</s:navigationContent>
当我运行这个示例时,我得到了这个错误: verifyError:错误#1079:加载的代码中不允许使用本机方法。
at flash.display::MovieClip/nextFrame()
at mx.managers::SystemManager/deferredNextFrame()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\SystemManager.as:284]
at mx.managers::SystemManager/preloader_preloaderDocFrameReadyHandler()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\SystemManager.as:2633]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.preloaders::Preloader/timerHandler()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\preloaders\Preloader.as:515]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
非常感谢
I want to create option menu on my qnx view, I am using air SDK, I got this example
<?xml version="1.0" encoding="utf-8"?>
<s:ViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="createMenu(event)"
firstView="views.testHomeView" xmlns:utils="utils.*">
<fx:Declarations>
</fx:Declarations>
<fx:Script>
<![CDATA[
import caurina.transitions.Tweener;
import mx.events.FlexEvent;
import qnx.events.QNXApplicationEvent;
import qnx.system.QNXApplication;
// Registers the drop down menu for PB application
protected function createMenu( event:FlexEvent ):void
{
QNXApplication.qnxApplication.addEventListener( QNXApplicationEvent.SWIPE_DOWN, pullDownMenu );
}
private function pullDownMenu( event:QNXApplicationEvent ):void
{
trace( "Menu pulled down" );
Tweener.addTween(slideMenu, {y: 0, time: 0.5, transition: "linear"});
/**
* add the mouse listener to hide the menu when the user clicks
* outside of the menu area
*/
stage.addEventListener(MouseEvent.CLICK, onStageMouseClick);
}
// Hide menu when the screen is touched outside menu
private function onStageMouseClick( e:MouseEvent ):void
{
/** if the user clicks outside of the menu area, hide the menu */
if (mouseY > slideMenu.height)
{
Tweener.addTween(slideMenu, {y: -slideMenu.height, time: .3, transition: "linear"});
stage.removeEventListener(MouseEvent.CLICK, onStageMouseClick);
trace( "Menu went up" );
}
}
]]>
</fx:Script>
<s:navigationContent>
<utils:Menu id="slideMenu">
</utils:Menu>
</s:navigationContent>
When I run this example I got this error:
VerifyError: Error #1079: Native methods are not allowed in loaded code.
at flash.display::MovieClip/nextFrame()
at mx.managers::SystemManager/deferredNextFrame()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\SystemManager.as:284]
at mx.managers::SystemManager/preloader_preloaderDocFrameReadyHandler()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\SystemManager.as:2633]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.preloaders::Preloader/timerHandler()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\preloaders\Preloader.as:515]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
Thanks a lot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能是因为您在不同的 Flex 版本之间切换,导致引用了不同版本的库 (.SWF)。
查看 此帖子。
This could be because you are switching between different versions for flex, causing different versions of library(.SWF) being referenced.
Look at this post.