This is a follow up to my previous question (Problems Scripting Multiple Buttons(nearly identical) in a single Action Script)
I am making an interactive flash Project...It has has 17 Separate scenes ...
- Intro Scene
- "Main_ Sequence"
- 15 Individually title song pages ....
Where my first issue is the "main sequence" has 15 Buttons and I need to link them to the 15 separate scenes ...I am using the following code...
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");
}
}
when I run the sequence I get the following 15 errors All 1021: Duplicate function definition. Source : function mouseDownHandler(event:MouseEvent):void {
I tried changing the ..._g.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
to include a unique #next to each DownHandler ex) TD_g.addEventListener12(MouseEvent.MOUSE_DOWN, mouseDownHandler1);
..I still get 15 errors...
Thanks !
P.S ...I am also looking to insert stop();
somewhere in that action script so that after the animation is played for this scene people have the opportunity to navigate and click the buttons instead of it "jumping" to the next scene!