Quiz based on Chapter 3 of BGP book - Beginning Game Programming With FLASH



//-------------------------------- Frame #1 code -------------------------
stop();
var snd0:Sound = new Sound();
snd0.load(new URLRequest("Congas.mp3"));

var snd1:Sound = new Sound();
snd1.load(new URLRequest("drumBit.mp3"));
var channela:SoundChannel = new SoundChannel();

var snd2:Sound = new Sound();
snd2.load(new URLRequest("harp_gliss.mp3"));


var snd3:Sound = new Sound();
snd3.load(new URLRequest("tabla.mp3"));

var sndClarinet:Sound = new Sound();
sndClarinet.load(new URLRequest("Clarinet.mp3"));
											   
channela = snd0.play();
startQuiz_btn.addEventListener(MouseEvent.CLICK, startQuizUp);

function startQuizUp(evt:MouseEvent) {
	channela.stop();
	gotoAndStop(2);
}


//-------------------------------- Frame #2 code -------------------------
stop();
channela = snd1.play();

drum_btn.addEventListener(MouseEvent.CLICK, drum);

function drum(evt:MouseEvent) {
	gotoAndPlay(3);
}

tabla_btn.addEventListener(MouseEvent.CLICK, tablaWrong);
																	   
function tablaWrong(evt:MouseEvent) {
	gotoAndPlay(7);
}


//-------------------------------- Frame #3 code -------------------------
stop();

channela = snd2.play();

harp3_btn.addEventListener(MouseEvent.CLICK, harp);

function harp(evt:MouseEvent) {
	gotoAndPlay(4);
}


//-------------------------------- Frame #4 code -------------------------
stop();

channela = snd3.play();

tablaRight_btn.addEventListener(MouseEvent.CLICK, tablaOK);

function tablaOK(evt:MouseEvent) {
	channela.stop();
	gotoAndPlay(5);
}

clarinet_btn.addEventListener(MouseEvent.CLICK, clarinetWrong);

function clarinetWrong(evt:MouseEvent) {
	gotoAndPlay(7);
}


//-------------------------------- Frame #5 code -------------------------
stop();

channela = sndClarinet.play();

clarinet_btn.addEventListener(MouseEvent.CLICK, clarinetOK);

function clarinetOK(evt:MouseEvent) {
	gotoAndPlay(6);
}

saxophone_btn.addEventListener(MouseEvent.CLICK, tablaWrong);



//-------------------------------- Frame #6 code -------------------------
stop();

playAgain_btn.addEventListener(MouseEvent.CLICK, playAgain);

function playAgain(evt:MouseEvent) {
	gotoAndStop(2);
}


//-------------------------------- Frame #7 code -------------------------
stop();

tryAgain_btn.addEventListener(MouseEvent.CLICK, tryAgain);

function tryAgain(evt:Event) {
	gotoAndStop(1);
}