Share Posted November 11, 2015 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. Link to comment Share on other sites More sharing options...
Share Posted November 11, 2015 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. 1 Link to comment Share on other sites More sharing options...
Author Share Posted November 11, 2015 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. 1 Link to comment Share on other sites More sharing options...
Share Posted November 11, 2015 Excellent, thanks for sharing. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now