Good day!
Im new to actionscript 3, and id like to know how to use gotoAndPlay to target an object (drawn from hand to stage) on the stage using actionscript file?
My code is this:
package
{
import flash.display.MovieClip;
public class moveframe extends MovieClip
{
public function moveframe()
{
**parent.getChildByName("stick").gotoAndPlay(2);**
}
}
}
It will only generate an error message saying: “Call to possibly undefined method gotoAndPlay through a reference with static type flash.display:DisplayObject.
parent.getChildByName(“stick”).gotoAndPlay(2);”
I dont know what this error message means, but does anyone knows what the problem is?
I tried to trace the X position of the child named “stick” using: traced(parent.getChildByname(“stick”).x); to make sure that the object is already existed, but it produce the X position of my “stick” object which means that it is present. but when i try to use gotoAndPlay(2) it will make an error.
does anyone knows any alternative way to refference the movieclip object that has been put to stage?
thank you…