SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast afishinsea's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Rollovers and play clips of sounds

    Hi,

    I have read all the threads on adding sound that I can find, not quite covering what I need to know tho!

    I wish to add sound to several pages created in Dreamweaver, both sound on rollover of button, and MP3 audio clips that play in a new window with a description when clicked - i have followed the methods suggested in dreamweaver, but it doesn't do either. For 'rollover' the mouse goes over and then a new window pops up with Quicktime and plays the rollover sound through that.
    Same thing happens on 'mouse down', but will not stay within the same page it always plays the sound in a new pop-up.

    No flash please - this has to be done without!

    Any ideas...

    Thanks
    Get Wet : Dive In
    Graphic Design : London : UK

  2. #2
    SitePoint Addict theGuest's Avatar
    Join Date
    Jun 2002
    Location
    Vancouver, BC Canada
    Posts
    372
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool

    Well... as good as any board can be, they're not comparable to a search engine.

    Here's the script/code you need for your project, and below that is a link to a DogPile search page where you can learn more about this stuff (take note of what keywords i used in the search box).

    (replace the following sound file names)

    Create a new html page and put the sound file description in it. Format that page anyway ya like. In the HEADER of the document, put this code:
    • <bgsound src="oompaloompa.mp3">
    This will loud the disred mp3 file in the bg of the document when the page is called. This is your new window btw.

    In your main document, put this code into the HEADER section of the page:
    • <script language="JavaScript" type="text/javascript">
      <!--
      function playSound(soundobj) {
      var thissound= eval("document."+soundobj);
      thissound.Play();
      }
      -->
      </script>

      <embed src="click.wav" autostart="false" hidden="true" name="mySound">
    And here's what the html link code would be on your page: (replace the link url & link text)
    • <a href="newWindow.html" onMouseOver="playSound('mySound')" target="_new">Play My Sound!</a>
    If you want the sound to be activated by a mouse click, then replace the onMouseOver above with onClick.

    The coolest thing about this method is that by having the sound called through a mouseOver, instead of a click, you make sure the sound gets played before the clicked link can leave the current page. Just make sure you do 2 extra things for this:

    1) Make your button sound effect very small in file size -- i.e. no more than 6kb if possible. Use 11khz and 16bit mono for your wav settings.

    2) Use a preLoad script to load the sound file when the page loads, so that it'll be ready to go as soon as a button gets clicked.

    Let me know if you have any trouble with this. Just read carefully though and it should be fairly easy to pull off.

    Checkout this page for more learnin'.
    http://www.dogpile.com/info.dogpl/se...2Bplay%2Bsound

  3. #3
    SitePoint Enthusiast afishinsea's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers!

    I wil ltry this over the weekend and let you know how it goes... Thanks again.
    Get Wet : Dive In
    Graphic Design : London : UK


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •