Skip to main content
rob day
Community Expert
Community Expert
March 10, 2008
Question

getChildAt and methods

  • March 10, 2008
  • 2 replies
  • 444 views
I know I can manipulate a property via getChildAt, but I can't seem to get a method to work. So for a movie clip: container1.getChildAt(0).x=100; works, but container1.getChildAt(0).gotoAndStop(10); doesn't. Is it possible to get a method to work this way?

This topic has been closed for replies.

2 replies

rob day
Community Expert
rob dayCommunity ExpertAuthor
Community Expert
March 10, 2008
Thanks!
March 10, 2008
getChildAt returns a DisplayObject, and while DisplayObject has an x property, it does not have a gotoAndStop method, which belongs to the MovieClip class.

So if you know the object returned by getChildAt is a MovieClip, you can cast the result to a MovieClip and use gotoAndStop.