[CS3] addChild problems...
I have this code:
Code:
private function loadSections () {
//create top right section
topRight = new MovieClip();
topRight.x = 250 - (6 * ts);
topRight.y = 2 * ts;
myBuildParent.addChild(topRight);
var txtOption:Array = new Array();
//create the 5 text options
for (var i:int=1; i<6; i++) {
txtOption[i] = new TextField();
txtOption[i].text = "Option" + i;
txtOption[i].x = 2 * ts;
txtOption[i].y = i * ts;
topRight.addChild(txtOption[i]);
}
defineOption(1, "Buy", 101);
}
private function defineOption (optNum:int, txt:String, type:int):void {
//this is what doesnt work =(
//causes TypeError: Error #1010: A term is undefined and has no properties.
myBuildParent.topRight.txtOption[optNum].text = txt;
trace(myBuildParent); //returns: [object MovieClip]
trace(myBuildParent.topRight); //returns: undefined
}
I can't seem to define text for txtOption[#] which is a child of topRight which is a child of myBuildParent... I have this feeling its a really simple answer but I've spent the last two hours trying to figure it out... :mad:
anyways, thanks in advance for any help you can give,
ChaseNYC