Adding two functions to one button (gotoAndPlay, stop sound)
Hello everyone! First of all, I`d like to say that i`m total newbie regarding to as3. Ok, lets look at my problem.. I have 2 scenes (first is main menu with New Game button; second scene is intro for game). I`m having difficulties to make two functions within one button. Why do I need that? First function is to go to next scene (in my case, IntroScene). Second is for turning off sounds, so I can`t hear them in next scene.
Here is the code:
var bobobg:bobomusic;
var sndChannel:SoundChannel;
bobobg = new bobomusic;
sndChannel = bobobg.play();
//MAIN MENU BUTTONS - NEW GAME
newgame_btn.addEventListener(MouseEvent.CLICK, buttonClick3);
newgame_btn.addEventListener(MouseEvent.CLICK, buttonClick4);
function buttonClick3(event:MouseEvent):void{
gotoAndPlay(1, "IntroScene");
}
function buttonClick4(event:MouseEvent):void{
bobobg.stop();
}
Error message: "TypeError: Error #1006: stop is not a function.
at MainMenu_fla::MainTimeline/buttonClick4()"
I would really appreciate if some one could help me with this. Thank you!
