1

I'm trying to modifty the Flex Tree control to allow a user to select multiple items by just clicking each of the desired elements (ie I don't want them to have to press Ctrl or Shift). If the user clicks a selected item a 2nd time, it will deselect it. Can anyone help me out?

Thanks!

erikcw
  • 10,787
  • 15
  • 58
  • 75

2 Answers2

2

I just had to do this with a datagrid, since they are both based on list it will work for you too

How can I get a datagrid to behave like the ctrl key is active?

Community
  • 1
  • 1
invertedSpear
  • 10,864
  • 5
  • 39
  • 77
0

You can create a simple custom component of ur own. Here is the code:

package com { import flash.events.MouseEvent; import mx.controls.Tree;

public class ForceCtrlTree extends Tree
{
    override protected function mouseClickHandler(event:MouseEvent):void
    {
        event.ctrlKey = true;
        super.mouseClickHandler(event);
    }
    override protected function mouseDownHandler(event:MouseEvent):void
    {
        event.ctrlKey = true;
        super.mouseDownHandler(event);
    }
}

}

Import this package into your project. Then declare the tree component as follows:

Now you need not click ctrl to select multiple objects.

user723644
  • 31
  • 2