在视图中将数据推入选项卡式视图导航器

时间:2012-04-03 06:40:16

标签: actionscript-3 flex mobile flash-builder flex4.5

我的Flex移动应用程序中有这样的视图:

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" title="aaa" actionBarVisible="false" creationComplete="view1_creationCompleteHandler(event)">
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
    <![CDATA[
        import valueObjects.Hasta;
        import mx.events.FlexEvent;
        public var gelen:Hasta= new Hasta();
        protected function view1_creationCompleteHandler(event:FlexEvent):void
        {
            // TODO Auto-generated method stub
            gelen=data as Hasta;

        }

    ]]>
</fx:Script>

<s:TabbedViewNavigator width="100%" height="110%">

    <s:ViewNavigator id="vn1" label="Hasta bilgileri-Hasta Yatış Bilgileri" width="100%" height="100%" firstView="views.HastabilgileriView" />
    <s:ViewNavigator id="vn2" label="Menu-Doktor Bilgileri" width="100%" height="100%" firstView="views.MenuView"/>


</s:TabbedViewNavigator>

我想将数据(gelen)发送到tabbedviews(到views.HastabilgileriView / views.MenuView)我该怎么做?

2 个答案:

答案 0 :(得分:1)

以这种方式尝试:

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" title="aaa" actionBarVisible="false" creationComplete="view1_creationCompleteHandler(event)">
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
    <![CDATA[
        import valueObjects.Hasta;
        import mx.events.FlexEvent;
        [Bindable]
        public var gelen:Hasta= new Hasta();
        protected function view1_creationCompleteHandler(event:FlexEvent):void
        {
            // TODO Auto-generated method stub
            gelen=data as Hasta;

        }

    ]]>
</fx:Script>

<s:TabbedViewNavigator width="100%" height="110%">

    <s:ViewNavigator id="vn1" label="Hasta bilgileri-Hasta Yatış Bilgileri" width="100%" height="100%" firstView="views.HastabilgileriView" firstViewData="{gelen}" />
    <s:ViewNavigator id="vn2" label="Menu-Doktor Bilgileri" width="100%" height="100%" firstView="views.MenuView" firstViewData="{gelen}"/>


</s:TabbedViewNavigator>

答案 1 :(得分:0)

要在您可以使用的视图之间推送数据:

navigator.pushView(views.SomeView, data);

查看此link,如果您需要其他信息,请查看以下link。我认为这些链接将为您提供完成任务所需的信息。