Sunday, February 22, 2009

Add Sound effect to your mouseover event in HTML


function onSoundlibLoaded() {
$('a').mouseover(function () {
soundPlay('2000hz', 10);
}).mousedown(function () {
soundPlay('click2', 50);
});
$('#say').unbind('mousedown').mousedown(function () {
soundPlay('saq2_' + String('0' + Math.floor(Math.random() * 23 + 1)).substr(-2), 100);
});
$('#name-saq').unbind('mousedown').mousedown(function () {
soundPlay('saq1_' + String('0' + Math.floor(Math.random() * 23 + 1)).substr(-2), 100);
});
$('.email-saq').unbind('mousedown').mousedown(function () {
soundPlay('saq3_' + String('0' + Math.floor(Math.random() * 23 + 1)).substr(-2), 100);
});
}
function soundPlay(sid, vol) {
getSwf("soundlib").playA(sid, vol);
}

source: http://saqoosha.net/en/category/flash/