Search code examples
actionscript-3apache-flexmobileflash-builderflex4.5

Push Data Into TabbedViewNavigator in View


I have a view like this in my Flex mobile Application:

<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>

And I want to send data(gelen) to tabbedviews (to views.HastabilgileriView/views.MenuView) How can I do that?


Solution

  • try it in this way:

    <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>