“QNXApplication.qnxApplication.addEventListener”上出现错误

发布于 2025-01-03 04:48:36 字数 2952 浏览 4 评论 0原文

我想在我的 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()

Error

Thanks a lot

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

单调的奢华 2025-01-10 04:48:36

这可能是因为您在不同的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文