How to control mouse events with other mouse events Actionscript 3, please help!
Hello,
I'm working on a virtual guitar simulation project and to be honest my flash skills are very beginner.
Right now all the sounds (78 of them) on my guitar play using the roll_over event but that doesn't give the user much control over what sound is played.
The actionscript im using to play my sounds is this;
for(var i:uint = 0; i < buttonArray.length; i++){
buttonArray.addEventListener(MouseEvent.ROLL_OVER, buttonRolledOver);
}
//This function stops any sound clip that is playing and
//plays the sound file thats clicked.
function buttonRolledOver(e:MouseEvent):void{
// SoundMixer.stopAll(); -- stops sounds playing when next one is played
for(var i:uint = 0; i < buttonArray.length; i++){
if(e.target == buttonArray){
var s:Sound = new Sound();
s.load(new URLRequest(soundArray));
s.play();
}
}
}
What i want to do is only play a sound with the roll_over event when the left click is held down.
I'd very much appreciate some help with that. A friend of mine advised me to use an if statement but I'm not really sure how to implement that.
Thanks!
