;

PDA

Click to See Complete Forum and Search --> : AS is driving me nuts


TacticalReaper
07-28-2008, 03:59 PM
Ok i am in a transition phase , i am trying to move from AS2 to AS#

so far it has smooth sailing but now i see a storm building up ahead
unless some can help me stear away

ok here is the problem

I have this code
function question() {
for (var i:int=0; i<questList.length(); i++) {
var ansList :TextField = new TextField;
ansList.type =TextFieldType.INPUT;
ansList.border = true;
ansList.x =(mytxt2.width+mytxt2.x)+10;
ansList.y=mytxt2.y;
questHolder.addChild(ansList);
}
}

my question is how do i retrieve the data entered into those text fields by users and store it for later use
any ideas??:confused:

neznein9
07-28-2008, 04:05 PM
You'll need to store references to those textfields so another function can find them later:


var inputFields:Array = new Array();

function question() {
for (var i:int=0; i<questList.length(); i++) {
// ...
inputFields.push(ansList);
}
}

// ..

trace(inputFields[3].text);

TacticalReaper
07-28-2008, 05:09 PM
Thanks a lot that worked!!!