yet anohter sound mouse over question

Discussion in 'HTML' started by Kryss, Jun 21, 2006.

  1. Kryss

    Kryss Guest

    I am trying to create a mouse over with a static gif, an animated gif
    and a wav or mp3
    per my clients request

    I can get te image mouseover, but not the sound.

    http://thewargame.com/working/game.htm

    Any suggestions are appreciated. At the moment i simply have the mouse
    over image up without the sound
    Regards,
    Kryss

    PS oh and it would be nice to be cross browser compliant (those are his
    words)
     
    Kryss, Jun 21, 2006
    #1
    1. Advertising

  2. Hi Kryss,


    Here is the script...

    <!-- --><bgsound id="soundfiles">
    <script language="JavaScript"><!--
    var aySound = new Array();

    aySound[0] = "../audio/select.wav";
    aySound[1] = "../audio/click.wav";

    IE = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 1:0;
    NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 1:0;
    ver4 = IE||NS? 1:0;
    onload=auPreload;
    function auPreload() {
    if (!ver4) return;
    if (NS) auEmb = new Layer(0,window);
    else {
    Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>";
    document.body.insertAdjacentHTML("BeforeEnd",Str);
    }
    var Str = '';
    for (i=0;i<aySound.length;i++)
    Str += "<EMBED SRC='"+aySound+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
    if (IE) auEmb.innerHTML = Str;
    else {
    auEmb.document.open();
    auEmb.document.write(Str);
    auEmb.document.close();
    }
    auCon = IE? document.all.soundfiles:auEmb;
    auCon.control = auCtrl;
    }
    function auCtrl(whSound,play) {
    if (IE) this.src = play? aySound[whSound]:'';
    else eval("this.document.embeds[whSound]." + (play? "play()":"stop()"))
    }
    function playSound(whSound) { if (window.auCon)
    auCon.control(whSound,true); }
    function stopSound(whSound) { if (window.auCon)
    auCon.control(whSound,false); }
    //--></script>

    ....and here is the call...

    <a href="newpage.html" onMouseOver="playSound(0)"
    onMousedown="playSound(1)">BUTTON</a>

    Hope that helps

    Andy



    "Kryss" <> wrote in message
    news:...
    >I am trying to create a mouse over with a static gif, an animated gif
    > and a wav or mp3
    > per my clients request
    >
    > I can get te image mouseover, but not the sound.
    >
    > http://thewargame.com/working/game.htm
    >
    > Any suggestions are appreciated. At the moment i simply have the mouse
    > over image up without the sound
    > Regards,
    > Kryss
    >
    > PS oh and it would be nice to be cross browser compliant (those are his
    > words)
    >
     
    Andrew Bailey, Jun 21, 2006
    #2
    1. Advertising

  3. Andrew Bailey wrote:
    > Hi Kryss,
    >
    >
    > Here is the script...
    >
    > <!-- --><bgsound id="soundfiles">
    > <script language="JavaScript"><!--
    > var aySound = new Array();


    <snipped ancient script>

    Haven't seen the LiveAudio plug in since Netscape 4.x and it not
    supported by later versions and the Gecko browsers. I have tried to hack
    to transfer the old but in to the new browser but it does not work.

    2nd Does not work in IE, maybe the new "upgrade" patches that settled
    that plug-in patent issue with embedded plug-in is a play here.

    In NN4.6 get error

    JavaScript Error: http://thewargame.com/working/game.htm, line 51:
    this.document.embeds[whSound] has no properties.

    I believe if you wish to have multimedia buttons that that flash is
    probably your best overall bet maximum support.

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Jun 21, 2006
    #3
  4. Kryss

    cwdjrxyz Guest

    Kryss wrote:
    > I am trying to create a mouse over with a static gif, an animated gif
    > and a wav or mp3
    > per my clients request
    >
    > I can get te image mouseover, but not the sound.
    >
    > http://thewargame.com/working/game.htm
    >
    > Any suggestions are appreciated. At the moment i simply have the mouse
    > over image up without the sound
    > Regards,
    > Kryss
    >
    > PS oh and it would be nice to be cross browser compliant (those are his
    > words)


    You can get an image or text onMouseOver for sound for the WMP on
    browsers that support ActiveX for the WMP, This means IE browsers and
    close relatives with the WMP installed, but not the Mozilla
    family(recent Mozilla, Firefox, Netscape) unless they have added a
    special third party ActiveX plugin for their browser. Here is an
    example at http://www.cwdjr.net/rootold/soundscript.html . It has both
    a onMouseOver and link to another page for text, an image, and a tiny
    hotspot(period) just under the animated frog. In this case the sound is
    selected at random from an array of 11 different wav and midi files.
    You likely also could use mp3 and possibly wma. The important thing is
    that this method does no harm if you are on a browser that does not
    support it - you just do not hear the sound. I dug this up from some
    old backups of mine, and the code is old. However it at least validates
    as W3C html 4.01 transitional and CSS. You will most likely need to
    change the code for a fixed sound URL for each hot image rather than
    using the random one on my page. Sorry, but this is the best I have at
    hand at the moment. If there is a method that is general for all common
    browsers and all common sound players, I have not seen it. But then I
    have not researched this subject in a long time.
     
    cwdjrxyz, Jun 21, 2006
    #4
  5. Kryss

    Kryss Guest

    thank you everyone for your suggestions, this page will have flash
    involved as well so perhaps that is the best way to do it but for the
    sample sans flash, these will work wonders

    this is an awesome place
    Thanks again
     
    Kryss, Jun 22, 2006
    #5
    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. Davisro
    Replies:
    2
    Views:
    1,316
    Jim Corey
    Apr 23, 2004
  2. Max
    Replies:
    7
    Views:
    9,124
  3. Luc The Perverse

    Sound Quality In Sound API

    Luc The Perverse, Oct 30, 2005, in forum: Java
    Replies:
    4
    Views:
    1,489
    Andrew Thompson
    Oct 31, 2005
  4. Replies:
    0
    Views:
    507
  5. Berehem
    Replies:
    4
    Views:
    561
    Lawrence Kirby
    Apr 28, 2005
Loading...

Share This Page