这是我之前的问题( Problems Scripting Multiple Buttons(nearlyly same) in a single Action Script)的后续问题
我正在制作一个交互式 Flash 项目......它有 17 个独立的场景......
- 介绍场景
- “主序列”
- 15个单独的标题歌曲页面....
我的第一个问题是“主序列”有 15 个按钮,我需要将它们链接到 15 个单独的场景......我正在使用以下代码......
TD_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
s_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
ats_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
iyk_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
hms_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
tf_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
hd_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
ld_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
ll_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
ts_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
ipsy_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
ysm_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
ihm_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
iss_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
tl_g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
var nameOfButton:String=event.currentTarget.name;
if (nameOfButton=="TD_g") {
gotoAndStop(1, "Tweedlee_Dee");
} else if (nameOfButton=="s_g") {
gotoAndStop(1, "Sincerely");
} else if (nameOfButton=="ats_g") {
gotoAndStop(1, "Ain’_that_a_shame");
} else if (nameOfButton=="iyk_g") {
gotoAndStop(1, "I_hear_you_knocking");
} else if (nameOfButton=="hms_g") {
gotoAndStop(1, "Hearts_made_of_stone");
} else if (nameOfButton=="tf_g") {
gotoAndStop(1, "Tutti_fruiti");
} else if (nameOfButton=="hd_g") {
gotoAndStop(1, "Hound_Dog");
} else if (nameOfButton=="ld_g") {
gotoAndStop(1, "Little_darlin");
} else if (nameOfButton=="ll_g") {
gotoAndStop(1, "Louie_Louie");
} else if (nameOfButton=="ts_g") {
gotoAndStop(1, "Twist_and_shout");
} else if (nameOfButton=="ipsy_g") {
gotoAndStop(1, "I_put_a_spell_on_you");
} else if (nameOfButton=="ysm_g") {
gotoAndStop(1, "You_shook_me");
} else if (nameOfButton=="ihm_g") {
gotoAndStop(1, "I_can_hear_music");
} else if (nameOfButton=="iss_g") {
gotoAndStop(1, "I_shot_the_sheriff");
} else if (nameOfButton=="tl_g") {
gotoAndStop(1, "Tainted_love");
}
}
当我运行序列时,出现以下 15 个错误1021: Duplicate function definition. Source : function mouseDownHandler(event:MouseEvent):void {
我尝试将其更改为..._g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
在每个 DownHandler ex) 中包含一个唯一的#next) TD_g.addEventListener12(MouseEvent.MOUSE_DOWN, mouseDownHandler1);
..我仍然收到 15 个错误...
谢谢 !
PS ...我还希望stop();
在该动作脚本中插入某个位置,以便在为该场景播放动画后,人们有机会导航并单击按钮,而不是“跳转”到下一个场景!