0

When we have the focus on a item in TREE component in flash builder app, and start to press keys in our keyboard, the focus changes to the item that begins with the letter that we just push. For example, we have the next data in our Tree component "fruits":

Fruits --Apple --Orange --Peach

if we have a focus on the item 'Peach' and pressing 'a' on your keyboard, the focus will automatically move to the item 'Apples'.

I NEED DISABLE THIS FUNCTION

I made some attempts with event.Preventdefault() function, called from different triggers such as 'textInput' 'keyDown' 'keyFocusChange' and others but did not get the results I need. I paste some code to explain better

protected function tree2_keyDownHandler(event:KeyboardEvent):void
{
// TODO Auto-generated method stub
trace('press key!');
event.preventDefault();
}

<mx:Tree id="tree2" keyDown="tree2_keyDownHandler(event)" />

Thanks in advance

2 Answers2

0

Try
mx:Tree id="tree2" selectable="false"

0
package yourPackage {

    import flash.events.KeyboardEvent;
    import flash.events.TimerEvent;
    import mx.controls.Tree;

    public class YourNewTree extends Tree {

        public var keyNav:Boolean = false;

        override protected function keyDownHandler(event:KeyboardEvent) : void {
            if(keyNav){super.keyDownHandler(event);}
        }

        override protected function keyUpHandler(event:KeyboardEvent) : void {
            if(keyNav){ super.keyUpHandler(event); }
        }
    }
}
Shegit Brahm
  • 725
  • 2
  • 9
  • 22