PDA

View Full Version : strangeness with embed objects


kwhubby
12-08-2002, 08:56 AM
I have found wierd errors when using this in scripts (explo being an embed object) :

document.getElementById("explo").stop()
document.getElementById("explo").play()

with this too in body (<embed id="explo" width="0" height="0" autostart="false" loop="false" src="explode.wav">)
it works fine on most machines and IE browsers, but sometimes a computer wont like it, one strange example was were 2 machines, both with xp, and IE 6, differed in its response to that script, one played the sound, and the other gave an error. Is there a way to fix this problem, or at least to determine if it works on the machine using the script and to deactivate it if it wont work? is it simply:
if (document.getElementById("explo").play()) {
document.getElementById("explo").stop()
document.getElementById("explo").play()
}

zoobie
12-08-2002, 09:06 AM
Are you using semi-colons ; after the lines? Not sure of your code there. Are you using those parentheses around your tags? :rolleyes:

kwhubby
12-08-2002, 09:14 AM
no parenthesis, and do I really need those ; because theres a line break? and it 60% of the time, but fails because of this error the rest of the time

kwhubby
12-08-2002, 10:00 PM
if there isnt an alternative way to make sounds, than I would really just want something to see if the play(), and the stop() will work and not give errors, and if would give an error, than it will stop the play() or stop() from occuring.

I know you can do this with document.all with if (document.all)

but
if (play())
does not work
nor does
if (document.getElementById("explo").play())