
Welcome Guest
|
|
|
#1
|
|||
|
|||
|
Correct and inncorrect sounds for a drag and drop
I want to have 2 sounds for a drag and drop quiz...an Applause sound if the drag and drop is correct and a Buzzer sound if it is not.
I am using this code in the main frame: stop(); correctSound = new Sound(); correctSound.attachSound("Applause"); incorrectSound = new Sound(); incorrectSound.attachSound("Buzzer"); allCorrect =0; // check if all answers // are correct _root.onEnterFrame= function(){ if(_root.allCorrect==17){ _root.endComment = "All Correct!"; correctSound.start(); } } next_btn.onRelease = function(){ gotoAndPlay("Quiz Intro"); ; } prev_btn.onRelease = function(){ gotoAndPlay("Fastfood_Example"); ; } And this code on the object being dragged: on (press) { x = this._x; y = this._y; startDrag(this); _root.answer1 = ""; } on (release) { stopDrag(); if (this.hitTest(_root.lev1)) {//Change is here.. this._x = _root.lev1._x +92; this._y = _root.lev1._y -5; _root.answer1 = "That is correct!"; correctSound.start(); _root.allCorrect += 1; this.enabled = false; } else { this._x = x; this._y = y; _root.answer1 = "Sorry that is incorrect, please try again."; incorrectSound.start(); } } I can get the Applause sound to work, but not the Buzzer....can anyone tell me why? Thank you. |
|
#2
|
|||
|
|||
|
Found the answer to sound and drag and drop
Thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|

