Copy link to clipboard
Copied
Hi, I'm trying to drag a movieclip on stage, and with nine existing button instances, cause that movie clip to jump around and run at different labels (which are within the movie clip itself. I'm not sure what I'm doing wrong, but I get the error #2109 which says (similar error for each button):
ArgumentError: Error #2109: Frame label this.FlashLogo.logo1 not found in scene Scene 1.
at flash.display::MovieClip/gotoAndPlay()
at flash_fla::MainTimeline/logo1Over()
Any idea what I'm doing wrong? Here is my script:
function logo1Over(event:MouseEvent):void {
gotoAndPlay("this.FlashLogo.logo1");
}
function logo2Over(event:MouseEvent):void {
gotoAndPlay("this.FlashLogo.logo2");
}
function logo3Over(event:MouseEvent):void {
gotoAndPlay("this.FlashLogo.logo3");
}
function logo4Over(event:MouseEvent):void {
gotoAndPlay("this.FlashLogo.logo4");
}
function logo5Over(event:MouseEvent):void {
gotoAndPlay("this.FlashLogo.logo5");
}
function logo6Over(event:MouseEvent):void {
gotoAndPlay("this.FlashLogo.logo6");
}
function logo7Over(event:MouseEvent):void {
gotoAndPlay("this.FlashLogo.logo7");
}
function logo8Over(event:MouseEvent):void {
gotoAndPlay("this.FlashLogo.logo8");
}
function logo9Over(event:MouseEvent):void {
gotoAndPlay("this.FlashLogo.logo9");
}
// Event Listeners for all logo buttons
pbutton.addEventListener(MouseEvent.ROLL_OVER, logo1Over);
wfbutton.addEventListener(MouseEvent.ROLL_OVER, logo2Over);
fbutton.addEventListener(MouseEvent.ROLL_OVER, logo3Over);
bafbutton.addEventListener(MouseEvent.ROLL_OVER, logo4Over);
mbutton.addEventListener(MouseEvent.ROLL_OVER, logo5Over);
tbutton.addEventListener(MouseEvent.ROLL_OVER, logo6Over);
wbutton.addEventListener(MouseEvent.ROLL_OVER, logo7Over);
gbutton.addEventListener(MouseEvent.ROLL_OVER, logo8Over);
fbutton.addEventListener(MouseEvent.ROLL_OVER, logo9Over);
FlashLogo is the name of the movieclip instance that I placed on the stage with the other buttons.
Thanks, Dan Pearce
You would want to make a set of listeners for ROLL_OUT events, similar to what you did for the ROLL_OVER events. But if they all involve the same movieclip, you would only need one event handler function for all of them since the result is the same for all of them, telling the movie to go to its first frame.
Just as a note, if the buttons are all controlling the same movieclip, then you could probably reduce your coding effort substantially by renaming the buttons and using their names in the co
...Copy link to clipboard
Copied
I think what you need to do is change the lines to something like the following...
function logo1Over(event:MouseEvent):void {
this.FlashLogo.gotoAndPlay("logo1");
}
Copy link to clipboard
Copied
Thanks, worked like a charm!
Ned, any idea how I would make that symbol start itself over at frame one (frame one within the symbol) when the user went off of it with their mouse?
Thanks, Dan
Copy link to clipboard
Copied
You would want to make a set of listeners for ROLL_OUT events, similar to what you did for the ROLL_OVER events. But if they all involve the same movieclip, you would only need one event handler function for all of them since the result is the same for all of them, telling the movie to go to its first frame.
Just as a note, if the buttons are all controlling the same movieclip, then you could probably reduce your coding effort substantially by renaming the buttons and using their names in the code. If you named them as the frame labels you go to, then you could have one event handler function work for all of them that works something like...
function btnClicked(evt:MouseEvent):void {
this.FlashLogo.gotoAndPlay(evt.currentTarget.name);
}
// Event Listeners for all logo buttons
logo1.addEventListener(MouseEvent.ROLL_OVER, btnClicked);
logo2.addEventListener(MouseEvent.ROLL_OVER, btnClicked);
logo3.addEventListener(MouseEvent.ROLL_OVER, btnClicked);
etc....
Copy link to clipboard
Copied
Thanks so much Ned.
Copy link to clipboard
Copied
You're welcome
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more