From: "Tony Panza" <[EMAIL PROTECTED]>
Subject: ActiveX/VBScript problems while linking multiple controls

Hello,

I have been successfully able to VBScript to enhance an ActiveX control I
inserted into a webpage using the < OBJECT > tag. Here is the code that
works: (Note: spaces are added after the opening and closing tag signs so
you can see the code and not the actual output.)

< object id=RVOCX classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"
width=44 height=26 >
  < param name="SRC" value="sounds/audiosig.rpm" >
  < param name="CONTROLS" value="PlayButton" >
  < param name="CONSOLE" value="jukebox" >
< /object >
< form name="Formname" >
  < p >
    < select name="trackmenu" >
      < option selected value="heading" >- Select a Track -< /option >
      < option value="heading" >--- Disco ---< /option >
      < option value="http://www.i82.com/retro/sounds/iwsurviv.rpm" >I Will
Survive - Gloria Gaynor< /option >
      < option value="http://www.i82.com/retro/sounds/hotstuff.rpm" >Hot
Stuff - Donna Summer< /option >
    < /select >
  < /p >
  < p >
    < input type="button" value="Change Track" name="change" >
< script language="VBScript" for="change" event="onClick" >

If Document.Formname.trackmenu.selectedIndex = 2 Then
  Newsource = "http://www.i82.com/retro/sounds/iwsurviv.rpm"
Elseif Document.Formname.trackmenu.selectedIndex = 3 Then
  Newsource = "http://www.i82.com/retro/sounds/hotstuff.rpm"
End IF

RVOCX.SetSource(Newsource)

< /script >
  < /p >
< /form >

The above code works just fine with IE. When I click the "Change Track"
button, the new clip I want is loaded, and then played when clicking
PlayButton.

But... when I try to add another control, such as StopButton, I get a script
error saying "Object doesn't support this property or method:
'RVOCX.SetSource' " when I click the "Change Track" INPUT button. Here is
the code that produces the error:

< object id=RVOCX classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"
width=44 height=26 >
  < param name="SRC" value="sounds/audiosig.rpm" >
  < param name="CONTROLS" value="PlayButton" >
  < param name="CONSOLE" value="jukebox" >
< /object >
< object id=RVOCX classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA"
width=26 height=26 >
  < param name="CONTROLS" value="StopButton" >
  < param name="CONSOLE" value="jukebox" >
< /object >
< form name="Formname" >
  < p >
    < select name="trackmenu" >
      < option selected value="heading" >- Select a Track -< /option >
      < option value="heading" >--- Disco ---< /option >
      < option value="http://www.i82.com/retro/sounds/iwsurviv.rpm" >I Will
Survive - Gloria Gaynor< /option >
      < option value="http://www.i82.com/retro/sounds/hotstuff.rpm" >Hot
Stuff - Donna Summer< /option >
    < /select >
  < /p >
  < p >
    < input type="button" value="Change Track" name="change" >
< script language="VBScript" for="change" event="onClick" >

If Document.Formname.trackmenu.selectedIndex = 2 Then
  Newsource = "http://www.i82.com/retro/sounds/iwsurviv.rpm"
Elseif Document.Formname.trackmenu.selectedIndex = 3 Then
  Newsource = "http://www.i82.com/retro/sounds/hotstuff.rpm"
End IF

RVOCX.SetSource(Newsource)

< /script >
  < /p >
< /form >

The two ActiveX objects work together (e.g., clicking StopButton stops the
clip activated with PlayButton), but I get that script error whenever I
click on the "Change Track" button. Why am I getting this error? What am I
doing wrong? What can be done to fix it?

Thanks,

Tony Panza

Reply via email to