I have a movie clip called “aaa_test_clip.” One the first frame of aaa_test_clip, I created a button called “thebutton.” On the second frame of aaa_test_clip I have a blue graphic.
on the first frame of the root of my movie I wrote this function:
stop();
function doit(testvar:String):void {
this["aaa_"+testvar+"_clip"].gotoAndStop(2);
}
If I write on the next line
doit("test");
the function works and it takes you to the second frame of aaa_test_clip with the blue graphic.
My problem is that I would like to have the button call this function and the button function defined in the nested movie clip like this:
stop();
thebutton.addEventListener(
MouseEvent.MOUSE_UP,
function(evt:MouseEvent):void {
MovieClip(this.root).doit("test");
}
);
but when I click thebutton I get an error message:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at MethodInfo-6()
What am I doing wrong here? I attached my fla.