3 Replies Latest reply on Feb 10, 2010 5:01 PM by Flex harUI

    Attaching an event to a tree node

    Isaac Fung

      Hi there, hope to trigger a simple event when a tree node is click such as

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application

       

       

      xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

       

       

       

      <mx:XML id="treeData" xmlns="">

       

      <root>

      <node label="Section 1" >

      <node label="Section 1-1" >

      <node label="Section 1-1-1" click="lbl1.text='section 1-1-1';" />

      <node label="Section 1-1-2" click="lbl1.text='section 1-1-2';"/>

      <node label="Section 1-1-3">

      <node label="Section 1-1-3-1" />

      <node label="Section 1-1-3-2" />

      </node>

      <node label="Section 1-1-4" />

      </node>

      <node label="Section 1-2" >

      <node label="Section 1-2-1" />

      <node label="Section 1-2-2" />

      </node>

      </node>

      <node label="Section 2" >

      <node label="Section 2-1" >

      <node label="Section 2-1" />

      </node>

      </node>

       

      </root>

       

       

      </mx:XML>

       

       

      <mx:Tree width="246" left="10" top="10" id="tree" labelField="@label" dataProvider="{treeData.node}" height="540"/>

       

       

      <mx:Label id="lbl1" x="395" y="155" text="Label1" width="151" />

       

       

       

      </mx:Application>

       

       

       

       

      The tree and its children were rendered properly on screen but clicking the relevant nodes didn't trigger the event. Please advise.

       

      Regards

      I F