views:

80

answers:

1

I have a Dynamic TextField created with ActionScript (multiline, wordwrap & autosize=true).

While running the SWF, if you click into the TextField you get an arrow "move" cursor, then you can double-click to put it into Edit mode to select text. I want it to work like PowerPoint - if you click into the box you'll always get a flashing cursor with the ability to select/insert text, and you can click on the borders to drag, or the corners to resize.

I tried adding the focusIn event textField.stage.focus = this.textField but this didn't seem to do anything. When you click into the textField, I basically want it to act as though you followed with a double-click (Edit mode) without actually having to do the double-click.

Bonus: and instead of a 2nd double-click returning you to the Move mode (or whatever it's called) I want to select all text.

TL;DR: Is there some property of a Dynamic TextField that I can get/set to see if I'm in Edit or Move mode?

A: 

the TextField class is not made for what you want.

What you need to do is to create a subclass of Sprite. Let's call it SuperDuperTextField. You'll have to add all the interactivity logic to SuperDuperTextField. That SuperDuperTextField in turn contains a TextField for the text displaying and editing functionality.

while not in editing mode, you may wanna set both selectable on the TextField and mouseChildren on SuperDuperTextField to false for MouseEvents to work correctly.

To switch to edit mode, you'll need to set the focus and probably also the carret position.

hope that helps. :)

greetz
back2dos

back2dos