Got this to work:
textField.addEventListener(Event.ADDED_TO_STAGE, function(evt:Event):void {
var textField:UITextField = evt.currentTarget as UITextField;
textField.setFocus();
});
Thanks for everyone's help,
Brandon
----- Original Message ----
From: Andriy Panas <[EMAIL PROTECTED]>
To: [email protected]
Sent: Sunday, September 21, 2008 11:01:23 AM
Subject: Re: [flexcoders] Placing cursor inside UITextField
Hi Brandon,
Use the following to set focus for the textField's instance of UITextField:
var textField:UITextFie ld = new UITextField( );
textField.type = "input";
textField.autoSize = TextFieldAutoSize. LEFT;
textField.multiline = true;
textField.wordWrap = false;
textField.border = false;
myContainer. addChild( textField)
textField.setFocus( textField) ;
Notice, that first you have to add textField to the DisplayChildList
of corresponding container via addChild and only then you can call
"setFocus" on it.
2008/9/19 Brandon Krakowsky <[EMAIL PROTECTED] com>:
> I'm creating some Input UITextField instances dynamically, and then trying
> to place the cursor inside. Can't seem to get it working.
>
> var textField:UITextFie ld = new UITextField( );
> textField.type = "input";
> textField.autoSize = TextFieldAutoSize. LEFT;
> textField.multiline = true;
> textField.wordWrap = false;
> textField.border = false;
>
> stage.focus = textField;
>
> It seems to get the focus, but doesn't put the cursor inside. Can't just
> start typing. Also, textField.setFocus( ) doesn't work.
--
Med venlig hilsen / Best regards
Andriy Panas
[EMAIL PROTECTED] com