1 Reply Latest reply on Sep 27, 2007 9:46 PM by Newsgroup_User

    How to get a tree item when my mouse moves

    hybak
      I want to get the tree item which my cursor points to when my cursor moves over a tree.
      I can get a row index in itemRollOver event, but it seems useless.
      And I don't know how to use getObjectsUnderPoint method.
      Is there anyone who can help me?
        • 1. Re: How to get a tree item when my mouse moves
          Level 7
          Take a look this example:
          <?xml version="1.0" encoding="utf-8"?>

          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
          creationComplete="srv.send()">

          <mx:Script>
          <![CDATA[

          [Bindable]
          public var selectedNode:Object;

          [Bindable]
          public var XLC:XML;

          public function initList(event:Event) : void
          {
          XLC = event.target.lastResult;
          }

          public function treeChanged(event:Event) : void
          {
          selectedNode=Tree(event.target).selectedItem;
          }

          ]]>
          </mx:Script>

          <mx:HTTPService id="srv" url="../assets/tree.xml" resultFormat="e4x"
          result="initList(event)"/>

          <mx:HDividedBox width="100%" height="100%">
          <mx:Tree id="myTree" width="50%" height="100%" labelField="@label"
          showRoot="false" dataProvider="{XLC}" change="treeChanged(event)"/>
          <mx:TextArea height="100%" width="50%"
          text="Selected Item: {selectedNode.@label}"/>
          </mx:HDividedBox>

          </mx:Application>


          "hybak" <webforumsuser@macromedia.com> wrote in message
          news:fd5gao$229$1@forums.macromedia.com...
          >I want to get the tree item which my cursor points to when my cursor moves
          >over
          > a tree.
          > I can get a row index in itemRollOver event, but it seems useless.
          > And I don't know how to use getObjectsUnderPoint method.
          > Is there anyone who can help me?
          >