Jump to content
Search Community

Recommended Posts

Posted

Hi, I am trying to edit the "onKeyPress" function to allow deleting the text fields by pressing two keys (Shift & Backspace),

private static function onKeyPress($e:KeyboardEvent):void {
_keysDown[$e.keyCode] = true;
if ($e.keyCode == Keyboard.DELETE || _keysDown[Keyboard.SHIFT] && _keysDown[Keyboard.BACKSPACE])
...

The code above will not work unless I set the "hasSelectableText" Boolean to false:
 

newVars.hasSelectableText = ($targetObject is TextField) ? false : $hasSelectableText;

But now I am not able to highlight the text! how to solve that please? can you point me to the line where I can set the selected object as a text field or "hasSelectableText"?

Or if I added the text field inside a movieClip is there any way to use "SCALE_WIDTH_AND_HEIGHT" function instead of the normal scale mode? Thanks.

Posted

If you want to control the scale mode, you can do so with the 2nd parameter of the addItem() method, like: 

manager.addItem(myText, TransformManager.SCALE_WIDTH_AND_HEIGHT, true);

(that's an excerpt from the docs). 

 

Does that help at all? Unfortunately we're not in a position to provide consulting for altering the guts of the tools themselves, but hopefully the API exposes everything you need to accomplish your goal. 

  • Like 1
Posted

Thank you..

Actually I solved it but that was not easy because there's about 5000 lines of a code :|

 

TransformManager.as:

private static function onKeyPress($e:KeyboardEvent):void {
            _keysDown[$e.keyCode] = true;
            if ($e.keyCode == Keyboard.DELETE || (_keysDown[Keyboard.SHIFT] && _keysDown[Keyboard.BACKSPACE])) {

TransformItem.as:

 public function onPressDelete($e:Event = null, $allowSelectableTextDelete:Boolean = false):Boolean {
                        if (_enabled && _allowDelete /*&& (_hasSelectableText == false || $allowSelectableTextDelete)*/) {

That's all.

  • Like 1
Posted

Excellent, thanks for sharing. 

  • Like 1

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...