I have created a dynamic TextArea and want retrieve the value and display in the trace.
To run the code below you must drag the TextArea component into the stage.
import fl.controls.TextArea;
var totalTextArea=5;
//Create multiple textarea
for(var a:int = 0; a<totalTextArea; a++){
var cta:TextArea = new TextArea();
cta.move(300,0+(a*100));
cta.setSize(100, 60);
cta.condenseWhite = true;
cta.htmlText = a+'TextAreaA TextAreaB TextAreaC TextAreaD';
cta.name="TA"+a
addChild(cta);
trace(cta.text)
cta.addEventListener(MouseEvent.CLICK, ShowCurrentValue);
}
//accessing TextArea
function ShowCurrentValue(evt:MouseEvent):void{
for(var b:int = 0; b<totalTextArea; b++){
trace("somethingheere.txt")
}
I suppose you’re clicking in the TextArea.
If you want to list all textareas then I suggest you to put them into an array during creation and iterate over the array: