Reputation: 37
I have a problem with my actionscript 3.0
I can't access a child (let's call it child A), where child A has a parent Sprite (called sprite B). And Sprite B has a parent C (sprite).
For example:
var prBoard:Sprite = new Sprite();
prBoard.name="p";
var spMatrix:Sprite = new Sprite();
spMatrix.name="s";
var tf:TextField = new TextField();
tf.width = 30;
tf.height = 20;
tf.name = "r";
tf.text= "27";
this.addChild(prBoard);
prBoard.addChild(spMatrix);
spMatrix.addChild(tf);
The question is how to access textField tf?
Upvotes: 1
Views: 73
Reputation: 395
trace((((getChildByName("p") as DisplayObjectContainer).getChildByName("s") as DisplayObjectContainer).getChildByName("r") as TextField).text); //27
Upvotes: 1