Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    May 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help with function to play audio

    hey there, i am making a slideshow site, a user can add effects to pictures using a drop down menu and choose a sound to accompany picture when the slideshow runs.

    i have hit a snag, my function is taking in the choice from the user for both sounds, but playing them over one another, i think its something silly im missing out. here is the function where i think im going wrong:

    Code:
    function EvalSound()
    	{
        var sound1 = document.getElementById("sound1");
    		var choice = sound1.options[sound1.selectedIndex].value; 
    		 var sound2 = document.getElementById("sound2");
    		var choice2 = sound2.options[sound2.selectedIndex].value;
    		var pic1 =   document.getElementById("first_pic");
    		var pic2 =   document.getElementById("second_pic");
    	
    		soundManager.play(choice);
        soundManager.play(choice2);
    	}
    Thanks for any help

  • #2
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Code:
        soundManager.play(choice);
        soundManager.play(choice2);
    tells it to play both sounds
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  • #3
    New to the CF scene
    Join Date
    May 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yeah, i want it to play one sound if its on image one, another sound if its on image 2.

    I think its a simple if statement, but for the life of me i cant work it out :s

  • #4
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    yeah, i want it to play one sound if its on image one, another sound if its on image 2.
    What do you mean by 'if it's on..'; if what's on?
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  • #5
    New to the CF scene
    Join Date
    May 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    my slideshow has 2 images, the images are shown on the page and the user can specify an effect and sound for each image. There is then a button to play the slideshow, the first image, then the second. Currently the sound that the user selects in dropdown menu 1 (the first image) plays again when the second image is displayed, i want the second drop down menu sound to be played.

    Hope that makes more sense?
    Thanks

  • #6
    New to the CF scene
    Join Date
    May 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    bump, sorry my assignments in tomo


  •  

    Posting Permissions

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