1 Reply Latest reply on May 2, 2008 10:13 AM by ntsiii

    create a navigator from an action event

    schyst
      hi..im a just a new user of FLEX, maybe only a week, and i have this exercise on creating a UI similar to explorer. a tree will be placed in the left side and the window on the left. what i want is when i click an item in the tree, a tab will appear in the left window. and then when another item is clicked, then another tab will appear. i have this code on creating a button when a tree is clicked:

      import mx.controls.Button;
      public var button1:Button;
      public function treeClick():void {
      button1 = new Button();
      canvas1.addChild(button1);
      }

      <mx:Tree id="tree1" x="0" y="0" width="100%" showRoot="true" labelField="@label" height="100%" click="treeClick()">

      but when i change it to a TabNavigator, it won't work...and also, how can i know what item in the tree is selected or clicked?
        • 1. Re: create a navigator from an action event
          ntsiii Level 3
          Declale the TabNavigator im mxml, empty, with an id, say "tn1".

          Then create your content, which must be a container:
          var vb1 = new VBox;
          tn1.addChild(vb1);

          When a node is clicked, the Tree dispatches a click event. A handler for this event can reference the clicked node using event.target. Also, the Tree.selectedItem will be a reference to the selected node.

          Tracy