Skip to main content
Participant
November 18, 2009
Question

Error #2109 - driving me insane

  • November 18, 2009
  • 1 reply
  • 821 views

hi

i am quite new to AC3 and am having a bit of trouble with my buttons. when testing my movie i get this error code:

the gallery button was clicked!
ArgumentError: Error #2109: Frame label gallery not found in scene Scene 2.
    at flash.display::MovieClip/gotoAndStop()
    at new_fla::MainTimeline/clickSection()

so, i can tell that my code is working to some extent - only it isn't moving to the frame it is meant to. I should also mention that this is in Scene 2 of my flash document. all my frames are labeled correctly and are in conjunction with the code. (about, gallery, links etc...)

my code is as follows :

stop();

about.addEventListener(MouseEvent.CLICK,clickSection);
gallery.addEventListener(MouseEvent.CLICK,clickSection);
links.addEventListener(MouseEvent.CLICK,clickSection);

function clickSection(evtObj:MouseEvent) {
      trace ("the "+evtObj.target.name+" button was clicked!")
      gotoAndStop(evtObj.target.name);
}

if anyone could help me here i would be greatful ^__^ I'm going to end up kicking myself if the solution is staring me right in the face x__x

This topic has been closed for replies.

1 reply

Inspiring
November 18, 2009

do a couple things:

First have the function goto a specific frame number to be sure your code works.

Next have it goto a frame label-hardcoded to make sure you have that setup correctly.

Try setting the evtObj.target.name to a var first, like:

var frame:String = evtObj.target.name;

gotoAndStop(frame);

I have an example at work where i used exactly this, but wont be there for w few hours...

Worst case, to get around it, add a switch:

function clickSection(evtObj:MouseEvent) {

     var frame:String = evtObj.target.name;

     switch(frame){
          case "gallery":
          gotoAndStop(1);
          break;
          case "about":
          gotAndStop(2);
          break;
          default:
          trace("MeDunnoWhaddaDo");
     }
}
I'll post the example once I'm at work...
momoPichiAuthor
Participant
November 19, 2009

thank you for your reply.

i have changed it so if "links" button is clicked it will gotoAndStop on frame 3 for example and this works fine. I was just looking for a shortened version so my coding wasn't so bulky.

if anyone else can help i'd be greatful ^__^