I'm coding a proof-of-concept experiment to myself about buttons switching frames in flash CS4. Whenever i press the button when I run this however, it gives this error message, and I don't know what it means. "ArgumentError: Error #1063: Argument count mismatch on Untitled_fla::MainTimeline/NextFrame(). Expected 0, got 1.". Help?
stop();
var page = 1;
button.addEventListener(MouseEvent.CLICK, NextFrame);
function NextFrame(){
gotoAndPlay(2);
};
It actually means that your NextFrame()
function expected no arguments but instead it received one.
This happens because you are using NextFrame()
to listen for events: in AS3, event listener functions receive the event object they are listening for.
I prefer to solve the problem by adding the argument even when I don't use it:
function NextFrame(e: Event){
gotoAndPlay(2);
};