views:

45

answers:

2
var count:uint = 0;
var textInputs:Array /* of TextInputs */ = [];
for(var i:String in columnsData){
    textInputs[count] = new TextInput();

    addChild(textInputs[count]);
    count++;
}

here how can i access the first, second of Array of textinputs in the form of string or any thing to further proceed

A: 
(getChildAt(0) as TextInput).text //first
(getChildAt(1) as TextInput).text //second

If your sprite contains something other than TextInput at indices 0 & 1 you'll get null reference exception.

alxx
this getChildAt comes under..?
mani
public function ContinclickHandler():void { if(contin.label == "Continue") { Alert.show("Inside"); //first Alert.show(fieldInputs[0].text.toString()); }}So here I am accessing fieldInputs[0] in separate function but I cant show it flex script but the inside message in Alert is coming why not fieldinputs
mani
+1  A: 

I am not sure if I understood what your question is, but you're not setting the value for text inputs:

I prefer it the following way:

//make the array an instance variable instead of local var
//so that it can be accessed from other functions if required.
public var textInputs:Array = [];

for(var str:String in columnsData)
{
  var ti:TextInput = new TextInput();
  ti.text = str;
  addChild(ti);
  textInputs.push(ti);
}

You can access the values using textInputs[0].text etc.

if(textInput != null){
  for(var i:Number = 0; i < textInputs.length; i++)
    trace(textInputs[i].text);
}
Amarghosh