1 Reply Latest reply on Jul 16, 2010 5:56 AM by rootsounds

    mx:Tree as navigation

    djh88ukwb Level 1

      Hello all,

       

      I have built out a simple application, mainly using a <mx:Tree/> that i want to use as navigation.  Here is my application:

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009
                     xmlns:s="library://ns.adobe.com/flex/spark"
                     xmlns:mx="library://ns.adobe.com/flex/mx">
         
          <fx:Declarations>
              <fx:XMLList id="treeData">
                  <node label="Mail Box">
                      <node label="Category One">
                          <node label="Link One" link="canvas1"/>
                          <node label="Link Two" link="canvas2"/>
                          <node label="Link Three" link="canvas3"/>
                      </node>
                      <node label="Category Two" link="canvas4">
                          <node label="Link One" link="canvas5"/>
                          <node label="Link Two" link="canvas6"/>
                      </node>
                      <node label="Link One" link="canvas7"/>
                      <node label="Link Two" link="canvas8"/>
                  </node>   
              </fx:XMLList>
          </fx:Declarations>
         

          <mx:Tree id="myTree" width="209" height="394" labelField="@label"
                   showRoot="false" dataProvider="{treeData}"  x="10" y="10"/>
         
          <mx:Canvas width="516" x="227" y="10" height="394" borderStyle="solid" id="canvas1" visible="false">
              <s:Label text="Canvas 1" x="13" y="14"/>
          </mx:Canvas>
         
          <mx:Canvas width="516" x="227" y="10" height="394" borderStyle="solid" id="canvas2" visible="false">
              <s:Label text="Canvas 2" x="13" y="14"/>
          </mx:Canvas>
         
          <mx:Canvas width="516" x="227" y="10" height="394" borderStyle="solid" id="canvas3" visible="false">
              <s:Label text="Canvas 3" x="13" y="14"/>
          </mx:Canvas>
         
          <mx:Canvas width="516" x="227" y="10" height="394" borderStyle="solid" id="canvas4" visible="false">
              <s:Label text="Canvas 4" x="13" y="14"/>
          </mx:Canvas>
         
          <mx:Canvas width="516" x="227" y="10" height="394" borderStyle="solid" id="canvas5" visible="false">
              <s:Label text="Canvas 5" x="13" y="14"/>
          </mx:Canvas>
         
      </s:Application>

       

      Now what i want to do, is on the "change" attribute of the tree, to change a canvas to visible depending upon the "Link" inside the array.

       

      But it also needs to set all the others to not visible.

       

      DO you understand what i mean ?  If anyone could help me out with this is would be a great help