加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何在Flash Builder 4.5 Burrito中的ViewNavigators之间传递数

发布时间:2020-12-15 07:25:13 所属栏目:百科 来源:网络整理
导读:我试了一下,碰巧我很难弄清楚如何在TabbedMobileApplication中的ViewNavigator之间传递数据. s:TabbedMobileApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" fx:Declarations /fx:Declarations s:ViewNa
我试了一下,碰巧我很难弄清楚如何在TabbedMobileApplication中的ViewNavigator之间传递数据.

<s:TabbedMobileApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark">
    <fx:Declarations>
    </fx:Declarations>

    <s:ViewNavigator id="nav1" label="Nav1" firstView="views.Nav1Home" width="100%" height="100%"/>
    <s:ViewNavigator id="nav2" label="Nav2" firstView="views.Nav2Home" width="100%" height="100%"/>

</s:TabbedMobileApplication>

如何在nav1和nav2之间传递数据?我知道如何在导航视图之间执行此操作.

谢谢,
B.

解决方法

除非我在这里遗漏了什么,否则你想要做的就是在这里找一个脚本块并听取你的ViewNavigators的事件.然后在事件的处理程序中,调用目标ViewNav上的公共函数.

<s:TabbedMobileApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" creationComplete="init()">
    <fx:Declarations>
    </fx:Declarations>

    <fx:script><![CDATA[
        private function init():void{
               nav1.addEvenListener(CustomEvent.DATA,onData);
        }

        private function onData(ev:CustomEvent):void{
               nav2.setData(ev.data);
        }
    ]]></fx:script>



    <s:ViewNavigator id="nav1" label="Nav1" firstView="views.Nav1Home" width="100%" height="100%"/>
    <s:ViewNavigator id="nav2" label="Nav2" firstView="views.Nav2Home" width="100%" height="100%"/>

</s:TabbedMobileApplication>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读