Problem playing an embedded sound

Discussion in 'Javascript' started by OBAFGKM_RNS@yahoo.com, Jul 2, 2008.

  1. Guest

    I am not an expert in javascript, so forgive me if all this sounds
    dumb.
    On my webpage, I have slot machine. I want to hear a click sound when
    the wheels stop spinning. Heres how i can SORT OF do it:

    in my javascript:
    var sound = document.getElementById("wl1_click");sound.Play();

    and in my html:
    <embed id="wl1_click" src="clickb.wav" width="0" height="0"
    autostart="false" />

    and here are the problems:
    1. If i use hidden="true", the sound won't play in either Firefox
    or IE. Without that line, it plays.
    2. Even setting the width and height to "0", still shows an
    annoying tiny image in Internet Explorer, and creates a big extra
    space. Hidden="true" would solve that problem, but hidden="true"
    prevents the sound from playing for me.
    3. Also in IE, an annoying tag pops up saying "press SPACEBAR or
    ENTER to activate and use this control."

    I'm probably doing something wrong, so if anyone could help, it would
    be much appreciated. Thanks.
    , Jul 2, 2008
    #1
    1. Advertising

  2. Guest

    On Jul 2, 12:09 am, wrote:
    > I am not an expert in javascript, so forgive me if all this sounds
    > dumb.
    > On my webpage, I have slot machine. I want to hear a click sound when
    > the wheels stop spinning. Heres how i can SORT OF do it:
    >
    > in my javascript:
    > var sound = document.getElementById("wl1_click");sound.Play();
    >
    > and in my html:
    > <embedid="wl1_click" src="clickb.wav" width="0" height="0"
    > autostart="false" />
    >
    > and here are the problems:
    > 1. If i usehidden="true", the sound won't play in either Firefox
    > or IE. Without that line, it plays.
    > 2. Even setting the width and height to "0", still shows an
    > annoying tiny image in Internet Explorer, and creates a big extra
    > space.Hidden="true" would solve that problem, buthidden="true"
    > prevents the sound from playing for me.
    > 3. Also in IE, an annoying tag pops up saying "press SPACEBAR or
    > ENTER to activate and use this control."
    >
    > I'm probably doing something wrong, so if anyone could help, it would
    > be much appreciated. Thanks.


    I kind of rigged up a solution to these problems by doing this:
    <div style="position: absolute; z-index:
    -1;left:-10000;top:-10000;"><embed id="wl1_click" src="clickb.wav"
    width="0" height="0" autostart="false" ></div>

    Now the 1 pixel media player with the accompanying space and "press
    SPACEBAR..." messagebox are out of view.
    , Jul 2, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ron Clarke

    Sound lost when playing AVI files

    Ron Clarke, Feb 24, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    349
    Ron Clarke
    Feb 24, 2004
  2. Ike

    playing a sound

    Ike, Feb 26, 2004, in forum: Java
    Replies:
    6
    Views:
    436
    Erwin Moller
    Feb 26, 2004
  3. marko

    re-playing sound in J2ME

    marko, Dec 14, 2004, in forum: Java
    Replies:
    3
    Views:
    11,591
    Darryl L. Pierce
    Dec 15, 2004
  4. Christian Kremser

    Problem with playing sound files

    Christian Kremser, Mar 8, 2005, in forum: Java
    Replies:
    1
    Views:
    347
    Knute Johnson
    Mar 9, 2005
  5. Replies:
    0
    Views:
    505
Loading...

Share This Page