Lifting the Veil: Debugging
This article was significantly updated and accepted for publication by Adobe. It now lives here:
http://www.adobe.com/devnet/flash/articles/debugging_actionscript.html
This article was significantly updated and accepted for publication by Adobe. It now lives here:
http://www.adobe.com/devnet/flash/articles/debugging_actionscript.html
January 10th, 2008 at 9:59 am
Hi,
I am new to Flash. I am working on my school project.
I am using Flash 9 action script 3.
I have 3 scenes: 1st scene is Home. Other 2 has Home button. Home button works fine for Scene 2 but not for Scene3.
Scene 2 has this code for home button:
home1_btn.addEventListener(MouseEvent.CLICK, Scene1);
function Scene1(event:MouseEvent):void {
gotoAndPlay(1,”Scene1″);
}
If I copy or write it manually this code for Scene 3 home button it gives me compiler error:Duplicate function definition
If I write new code for Scene3 button as:
on(release){
gotoAndPlay(”Scene1″,1)
}
It says an Error:extra characters at the end
Any help would be appreciated.
January 14th, 2008 at 8:13 pm
pal,
Just so you know, the article linked from this page deals with ActionScript 2.0, which is significantly different from ActionScript 3.0. (I’m glad you read the article — assuming you did! — and hope it was useful to you, but just note that it may only be useful in AS2 projects.)
The “Duplicate function definition” error sounds to me like you’re declaring the same function,
Scene1(), in more than one location. This is no longer allowed in AS3 (neither is declaring the same variable more than once in the same scope), so try using a different function name each time.Your
on(release)code isn’t allowed in ActionScript 3.0 at all —on()andonClipEvent()aren’t supported in the new language — so you’ll have to place your code in keyframes only, rather than attached to objects.