Thursday, 15 April 2010

ActionScript reference to grandchild (child of child) element -



ActionScript reference to grandchild (child of child) element -

let's have basic mxml setup follows:

<item id="parent"> <frame> <mx:image/> </frame> </item>

how can refer attribute of image element referring grandchild (child of child) of parent item? i've tried daisy-chaining 2 calls getchildat(), i.e.:

parent.getchildat(0).getchildat(0)

but next error:

error: phone call perchance undefined method getchildat through reference static type flash.display:displayobject.

what proper way create phone call grandchild element?

getchildat() function returns displayobject

getchildat()

so must type cast follows.

displayobjectcontainer(parent.getchildat(0)).getchildat(0)

actionscript-3 parent-child mxml grandchild

No comments:

Post a Comment