1

I'm new to AS3, and I keep getting Error #1009 when I try to add a button. From some reading I did I gather it is when I reference something I think exists but that really doesn't, except I have added a correct instance_name, and this did not happen for any of my other buttons.

Below is my code:

stop();

//buttons
Erhu_btn.addEventListener(MouseEvent.MOUSE_DOWN, Erhu_func);
Flute_btn.addEventListener(MouseEvent.MOUSE_DOWN, Flute_func);
Guzheng_btn.addEventListener(MouseEvent.MOUSE_DOWN, Guzheng_func);
Ruan_btn.addEventListener(MouseEvent.MOUSE_DOWN, Ruan_func);
Yangqin_btn.addEventListener(MouseEvent.MOUSE_DOWN, Yangqin_func);
Compose_btn.addEventListener(MouseEvent.MOUSE_DOWN, Compose_func);
Intro_btn.addEventListener(MouseEvent.MOUSE_DOWN, Intro_func);

//function definitions
function Erhu_func(event:MouseEvent):void {
    gotoAndStop("Erhu"); 
}
function Flute_func(event:MouseEvent):void {
    gotoAndStop("Flute"); 
}
function Guzheng_func(event:MouseEvent):void {
    gotoAndStop("Guzheng"); 
}
function Ruan_func(event:MouseEvent):void {
    gotoAndStop("Ruan"); 
}
function Yangqin_func(event:MouseEvent):void {
    gotoAndStop("Yangqin"); 
}
function Compose_func(event:MouseEvent):void {
    gotoAndStop("Compose");
}
function Intro_func(event:MouseEvent):void {
    gotoAndStop("Intro"); 
}

All the buttons work except for the Intro_btn. I know it's probably a really simple mistake, but I can't figure it out, and I would really appreciate any light you could shed on my problem!

15leungjs1
  • 35
  • 8
  • If you are sure that problem come from `Intro_btn`, could you show us the code of `Intro` frame ? – akmozo Dec 15 '14 at 04:20
  • I put all my code in the same thing, and so this is all the code I have in my program, save the `stop()` code at the start of each frame label. – 15leungjs1 Dec 15 '14 at 23:55
  • So your `Intro` frame contains only a `stop()` ? And when you say that you try to add a button, which button do you mean ? how do you add all these buttons ? – akmozo Dec 16 '14 at 00:14
  • I put all my code in the first frame, which also happens to be the `Intro` frame, so all my code is in my `Intro` frame. – 15leungjs1 Dec 16 '14 at 04:38
  • By buttons I mean symbols which will take you to a different place in the timeline. To add buttons, I create a shape using the shape tool, then convert it into a symbol. I then change the instance name to, say, `Erhu_btn`, create the corresponding function as can be seen from my original post, and link the button and function together with an `Event Listener`. – 15leungjs1 Dec 16 '14 at 04:39
  • Is there any chance you could upload the FLA file somewhere for us? Say, shared on Google Drive? – Will Dec 16 '14 at 13:25
  • Yeah, sure! Here is the link: https://drive.google.com/file/d/0B7QpeWjzxPTVZ05ZMmtQRWVTZ2M/view?usp=sharing – 15leungjs1 Dec 16 '14 at 23:47
  • make sure you have a frame with "Intro" lable and check the name of the button "Intro_btn". – George Carlin Nov 21 '15 at 15:53

0 Answers0