/t5/animate-discussions/getchildat-and-methods/td-p/994254Mar 10, 2008
Mar 10, 2008
Copy link to clipboard
Copied
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?
/t5/animate-discussions/getchildat-and-methods/m-p/994255#M27348Mar 10, 2008
Mar 10, 2008
Copy link to clipboard
Copied
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.