I am trying to link a button that is inside a movie clip to a scene. The button has the instance name "cosmetic_btn" and the scene is called "Cosmetic Treatments".
On my main timeline I have the code:
cosmetic_btn.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(evt:MouseEvent):void {
gotoAndStop(1, "Cosmetic Treatments");
}
And on the timeline inside the movie clip I have this code:
MovieClip(root).gotoAndStop("Cosmetic Treatments");
When I run the document I get the following error:
Home, Layer 'actions', Frame 101, Line 1 | 1120: Access of undefined property cosmetic_btn. |
I have the instance name "cosmetic_btn" set on the button so I am unsure what is wrong here?