put this code in your "actions" layer on the keyframe the button appears
function onIntroClick(evt:MouseEvent):void {
gotoAndStop(1, "Scene 2");
}
instancename.addEventListener(MouseEvent.MOUSE_DOWN, onIntroClick);
If you want to add multiple buttons to the same scene, or you get an error that says something like "duplicate function", then you need to change the function name of each button to something different. The function name in the above code "onIntroClick" which is an arbitrary name, you can change it to whatever as long as it has a name. The easist way to do this is change the second button in your movie to "onIntroclick2" in the function name, and on the second line where flash calls the function. For example,
function onIntroClick(evt:MouseEvent):void {
gotoAndStop(1, "Scene 2");
}
instancename.addEventListener(MouseEvent.MOUSE_DOWN, onIntroClick);
function onIntroClick2(evt:MouseEvent):void {
gotoAndStop(1, "Scene 2");
}
instancename.addEventListener(MouseEvent.MOUSE_DOWN, onIntroClick2);
function onIntroClick3(evt:MouseEvent):void {
gotoAndStop(1, "Scene 2");
}
instancename.addEventListener(MouseEvent.MOUSE_DOWN, onIntroClick3);
Thursday, December 11, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment