Unfortunatley the onkeyup events seem to be stored and executed after
the changeImageSrc function has completed, so multiple bashes still
result in multiple pages flashing past.
paul.sherwood@gmail.com - 27 Jan 2006 17:37 GMT
An alternative approach would be to some how ignore onkeyup events
until the animal sound has finished playing. I use
<bgsound id="sounds" src="sounds/default.wav"/> **i realise bgsound
only works for IE, but the trouble im having with that is a story for
another day
function changeImageSrc(){
.
.
document.getElementById('sounds').src = nextSound;
}
ive no idea how to do that. bgsound doesnt seem to have a
'stillPlaying' method.
wrote on 27 jan 2006 in comp.lang.javascript:
> Wait till they're older...chuckle
>
> I have tried the setTimeout() function but unfortunately the browser
> 'remembers' all onkeyup events even during the wait period, which
> causes the images to scroll by slower but still uncontrolled.
No, no, each keyup is processed, but with an "empty process"
till the next baby bounce is accepted again.
Try:
<body onkeyup='doit()'>
<script ...
var wait = false;
function doit(){
if (wait) return;
wait = true;
setTimeout('wait=false',1000);
// and do whatever you were up to originally
}

Signature
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
paul.sherwood@gmail.com - 31 Jan 2006 10:56 GMT
Thanks Evertjan, the above works splendidly. Suddenly its all become
clear.
Paul
Evertjan. - 31 Jan 2006 11:13 GMT
wrote on 31 jan 2006 in comp.lang.javascript:
> Thanks Evertjan, the above works splendidly. Suddenly its all become
> clear.
There is nothing "above". ;-)
==========================
Please, for the sake of the NG, quote what you are replying to.
If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at the
top of the article, then click on the "Reply" at the bottom of the article
headers. <http://www.safalra.com/special/googlegroupsreply/>

Signature
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)