Jump to content
Search Community

TransformManager deleting TargetObject on backspace

trahm test
Moderator Tag

Recommended Posts

When I set item.hasSelectableText=true, and then edit a TextField not managed by TransformManager and hit the backspace, TransformManager deletes the current selected item.


I stopped TransformManager from doing this by changing the following code in TransformManager


private static function onKeyPress($e:KeyboardEvent):void {
           _keysDown[$e.keyCode] = true;
           if ($e.keyCode == Keyboard.DELETE ){        //|| $e.keyCode == Keyboard.BACKSPACE) {
           	_keyDispatcher.dispatchEvent(new KeyboardEvent("pressDelete"));
           } else if ($e.keyCode == Keyboard.SHIFT || $e.keyCode == Keyboard.CONTROL) {
           	_keyDispatcher.dispatchEvent(new KeyboardEvent("pressMultiSelectKey"));
           } else if($e.keyCode == Keyboard.UP || $e.keyCode == Keyboard.DOWN || $e.keyCode == Keyboard.LEFT || $e.keyCode == Keyboard.RIGHT) {
       		var kbe:KeyboardEvent = new KeyboardEvent("pressArrowKey", true, false, $e.charCode, $e.keyCode, $e.keyLocation, $e.ctrlKey, $e.altKey, $e.shiftKey);

Link to comment
Share on other sites

I wouldn't really recommend doing that, though, because it prevents the user from using BACKSPACE to delete an object. If you have an interface where objects can be selected and the user can edit a different TextField (not selected), you might just want to set allowDelete to false to eliminate that functionality altogether and then just manage the deletion stuff yourself in whatever way you want (you can still call deleteSelection() manually in a handler of your own). Just an idea.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...