0 Replies Latest reply on Nov 7, 2010 12:57 AM by aktell2007

    Tree and ViewStack components ....

    aktell2007 Level 1

      Hi there,

       

      If somebody could be of assitance with this code which I can't get right. I left a couple of lines to many in there which I tried out as well !

       

      thanks in advamce regards aktell2007

       

           <mx:XMLList 
                id="navigation">
                <node label="navigation">
                <node label="Mngt 1">
                <node label="Link One" view="View1"/>
                <node label="Link Two" view="View2"/>
                <node label="Link Three" view ="View3"/>
                </node>
                </node>  
           </mx:XMLList>
           
           <mx:Script>
                <![CDATA[
                     
                     import mx.events.FlexEvent;
                     import mx.events.ItemClickEvent;
                     import mx.events.ListEvent;
                     
                     [Bindable]
                     public var selectedNode:XML;
                     
                     private function treeChange(event:ListEvent):void {
                          
                          /* var selectedNode:XML = XML(event.itemRenderer.data);  */
                          var xmlList:XMLList = event.currentTarget.selectedItem.@view; 
                          
                          if ( selectedNode.hasOwnProperty("@view") ) {
                               
                          /* viewstack1.selectedChild= this[xmlList.toString()]; */
                          viewstack1.selectedChild=this[navigationTree.selectedItem.@viewstack1]; 
                          }
                     }
                ]]>
           </mx:Script>
      
           
           <mx:Tree 
                id="navigationTree" 
                labelField="@label" showRoot="false" 
                dataProvider="{navigation}" 
                y="10" 
                height="301" width="192" 
                change="treeChange(event)"/>
           
           <mx:ViewStack 
                x="200" y="10" 
                id="viewstack1" 
                     czz          
                <mx:Canvas 
                     id="View1" 
                     width="100%" height="100%">
                     <mx:Label 
                          x="32" y="27" 
                          text="View One" 
                          color="#FFFFFF"/>
                </mx:Canvas>
                
                <mx:Canvas 
                     id="view2" 
                     width="100%" height="100%">
                     <mx:Label 
                          x="32" y="27" 
                          text="View Two" 
                          color="#FFFFFF"/>
                </mx:Canvas>
                
                <mx:Canvas 
                     id="view3" 
                     width="100%" height="100%">
                     <mx:Label 
                          x="32" y="27" 
                          text="View Three" 
                          color="#FFFFFF"/>
                </mx:Canvas>
                
           </mx:ViewStack>