Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 9th, 2003, 04:05 AM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

Reply With Quote
  #2 (permalink)  
Old June 9th, 2003, 10:47 AM
Authorized User
 
Join Date: Jun 2003
Location: Lexington, KY, USA.
Posts: 46
Thanks: 0
Thanked 1 Time in 1 Post
Default

Can't say I've ever worked with an active-x control in script before, but here's a shot:

function playSound(){
number++;
document.soundMain.param("Filename").value="Assets/Sound"+number+".wav";
document.soundMain.play(); }

This assumes the object has a param[] collection that can be indexed by name.


-Van
(Old dog learning new tricks...)
Reply With Quote
  #3 (permalink)  
Old June 10th, 2003, 01:34 AM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the help
i'll let you know if it works
Bill
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sound mohand Visual Basic 2005 Basics 1 November 27th, 2007 05:03 PM
Most "in demand" language? meverha1 Intro Programming 3 December 26th, 2005 02:41 PM
Creating on-demand validation in DataGrid sankar General .NET 0 June 22nd, 2004 05:02 AM
About Video on demand nw61 C# 6 May 22nd, 2004 02:15 AM



All times are GMT -4. The time now is 09:04 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.