I constructed short script with action scripts 3 for mp/wav player for my project . This will flash will be running on top of Webcam Zone Trigger , this flash will randomly pick an audio to play .. motion >zone trigger > keyboard > flash > sound
example :
var my_sounds:Array = [Sound1, Sound2, Sound3];
//random number
var my_num:Number= Math.floor(Math.random()*3);
//And use it to pick a sound and instance that:
var ChosenSound = my_sounds[my_num]();
var playing:Sound = new ChosenSound();
//play and stop function using keyboard , this keyboard button will response with motion detection by webcam zone trigger .
stage.addEventListener(KeyboardEvent.KEY_DOWN,keyBoardPress);
function keyBoardPress(event:KeyboardEvent) {
//Space bar press
if (event.charCode == 32) {
playing.play();
}
//Shift key press
if (event.charCode == 16) {
playing.stop();
}
}
tewst
ReplyDelete