To expand tree items on doubleclick of Node

There are two properties to mention here itemDoubleClick , doubleClickEnabled . In itemDoubleClick property call a function with event like the below
itemDoubleClick=”tree_itemDoubleClick(event);
and in secound property doubleClickEnabled=”true”

Now write some code to expand the tree on click of node in the function.
private function tree_itemDoubleClick(evt:ListEvent):void   — here as u can see the event is ListEvent and u have import events package
import mx.events.ListEvent;

in the function
{
var node:XML = treeID.selectedItem as XML;      — this will get the node
var isOpen:Boolean = treeID.isItemOpen(node);    — this will check tree is opened or not
treeID.expandItem(node, !isOpen);                         — this will expand the tree if not and close if opened (viceversa)
}

Now on double of tree node that respected node will expand.

Advertisements

2 Responses to To expand tree items on doubleclick of Node

  1. Not that I’m impressed a lot, but this is a lot more than I expected for when I stumpled upon a link on SU telling that the info is awesome. Thanks.

  2. Patrick Whittingham says:

    What is the difference between doubleclick and itemdoubleclick?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: