我是AS3的新手,当我尝试添加按钮时,我不断收到错误#1009。从我的一些阅读中我得到的是,当我引用我认为存在的东西时,但实际上并没有,除非我添加了正确的instance_name,这对我的任何其他按钮都没有发生。
以下是我的代码:
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");
}
除了Intro_btn之外,所有按钮都有效。我知道这可能是一个非常简单的错误,但我无法弄明白,我真的很感激你能解决我的问题!