?? Lo del marco alrededor es por la línea: tf.border = true; pero creí que eso funcionaría. Prueba con esto a ver que tal (he puesto 2 textField para ver que no cambia de uno a otro). Aún así, si lo pruebas con CTRL+Enter el Flash CS al comenzar no estará seleccionado el textField, pero si luego ejecutas el swf compilado sí que lo estará:
Código ActionScript :
var tf:TextField = new TextField();
tf.type = TextFieldType.INPUT;
tf.border = true;
tf.addEventListener(Event.ADDED_TO_STAGE, tfAddedToStageHandler);
tf.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, tfFocusOutHandler);
tf.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, tfFocusOutHandler);
this.addChild(tf);
function tfAddedToStageHandler(event:Event):void
{
stage.focus = tf;
}
function tfFocusOutHandler(event:FocusEvent):void
{
event.preventDefault();
stage.focus = event.currentTarget as TextField;
}
var tf2:TextField = new TextField();
tf2.type = TextFieldType.INPUT;
tf2.border = true;
tf2.x = 200;
this.addChild(tf2);