SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Sound on demand

  1. #1
    SitePoint Member
    Join Date
    Jun 2003
    Location
    UK
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post Sound on demand

    Hi
    I am trying to create a function the enables the user to rotate through a series of sounds by clicking on a single image and am having real trouble because of my stupidity (I think)
    This the code I am using
    var number = 0;

    function playSound() {
    number++;
    document.soundMain.play(); }


    //-->
    </script>
    </head>

    <body>
    <object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" name="soundMain" width="1" height="1">
    <param name="Filename" value="Assets/sound1.wav">
    <param name="PlayCount" value="1">
    <param name="ShowControls" value="true">
    <param name="Autostart" value="false">
    <param name="Volume" value="100">
    <param name="ShowDisplay" value="true">
    <embed width="1" height="1" filename="Assets/sound1.wav" playcount="1" showcontrols="true" volume="100" showdisplay="true" name="soundMain"></embed>
    </object>
    <img src="Assets/grnbut.gif" width="50" height="50" onClick='playSound()'"><br>


    </body>

    How can I set up the function so that it cycles through four sound clips by changing the value of the sound source ... something like
    "Assets/sound" +number =".wav"

    Thanks
    Bill

  2. #2
    SitePoint Addict
    Join Date
    Aug 2001
    Location
    Los Angeles, CA
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So do you know what a for loop is or what? Because that's exactly what you need if you want to cycle through information like the way you described...

  3. #3
    SitePoint Wizard davidjmedlock's Avatar
    Join Date
    Dec 2002
    Location
    Nashville, TN USA
    Posts
    1,688
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you embedding windows media player there? If so, which version? There's some JavaScript you can use to change the file...


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
  •