Milad
Milad

Reputation: 1269

ActionScript 3 - getChildByName in nested movieClips

There are 3 nested movieClips with instance names of A, B, C.

So C contains B, and B contains A, and A contains a textField.

How can I solve this:

C.B.A.txtField.text = "hello"; // WORKS

C.B.getChildByName("A").txtField.text = "hello"; // WORKS

C.getChildByName("B").A.txtField.text = "hello"; // DOESN't WORK!
C.getChildByName("B").getChildByName("A").txtField.text = "hello"; // ALSO DOESN't WORK!

Please let me know if you can think of any other solution.

Upvotes: 0

Views: 135

Answers (1)

Andrew Sellenrick
Andrew Sellenrick

Reputation: 1016

Try this.

C["B"]["A"].txtField.text = "Jackpot!"

Upvotes: 1

Related Questions