He creado una función para automatizar la creación de campos de textos. La función es la siguiente:
function creaLabel(sTexto, posX, posY) {
//preparamos el formato
formato = new TextFormat();
formato.font = "Verdana";
formato.size = 10;
formato.bold = true;
formato.color = 0xFFFFFF;
//creamos la label
var textField_tf:TextField;
var textFieldName:String;
textFieldName="labelTxt"+(_level0.pActual-1)+"-"+i;
trace(textFieldName);
this.createTextField(textFieldName, 100, posX, posY, 0, 0);
this.textField_tf=this[textFieldName];
this.textField_tf.selectable = false;
this.textField_tf.text = sTexto;
this.textField_tf.autoSize = "center";
this.textField_tf.setTextFormat(formato);
//actualizamos xActual e yActual
xActual=x+this.textField_tf._width;
yActual=y+this.textField_tf._height;
i++;
}
No funciona como debería, ya que, cuando creo varios texfields, solamente aparece el último.
¿Cómo lo puedo solucionar?
Gracias.
