I take all that back. :)
 
If you set the TextField to selectable, then you can edit the TextField (as long as you also set the type to input):
 
         mytext.type = "input";
         mytext.selectable = true;
matt horn

From: Matt Horn [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 12, 2005 10:34 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Editing Text

I don't think you can make TextField controls editable. In your example, the import is not necessary, btw, since createTextField is a method of the root movieclip object (in this case, the application). This is for all intents and purposes a Flash object and not something you'd normally use in Flex. In Flex, the non-editable controls Label and Text derive from TextField, as do the _editable_ controls TextInput and TextArea.
 
You might be able to make a TextField editable with some creative use of keyboard listener (and making the TextField selectable), and then calling replaceSel or replaceText, but I think you'd be better off creating a TextInput in the first place -- this is also a matter of usability. Users who see label-like text do not expect it to be editable, any more than you expect to edit the label on a Button.
 
matt horn


From: carmhuntress [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 12, 2005 12:59 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Editing Text


Hi,
I am trying to dynamically getnerate text with an embeded swf file and
enabe the thing to be editable when you click on it.  Here is what I
have so far.

import mx.controls.TextInput;

_root. {
      _root.createTextField("mytext",1,_xmouse,_ymouse,200,100);
      mytext.type = "input";
      mytext.multiline = true;
      mytext.type = "input";
      mytext.border = false;
      mytext.background = "">};
Mouse.addListener(mouseListener);

Right now when I click on the text it re-creates the textfield.  How
do I set up something so when I click on it it becomes editable.  Thanks.










Yahoo! Groups Links

Reply via email to