<HTML> 
<HEAD>
<TITLE>DirectAnimation SDK, VBScript sample</TITLE>
<SCRIPT LANGUAGE="JScript">
<!--
if (window.top.frames.length!=0 && window.top.frames[0].ShowNoButtons!=null)
    window.top.frames[0].ShowNoButtons();
//-->
</SCRIPT>

</HEAD>	 

<BODY BGCOLOR=WHITE TOPMARGIN=15 LEFTMARGIN=20>
<FONT FACE="Verdana, Arial, Helvetica" SIZE=2> 
<CENTER>
<H1>Using Modifiable Behaviors and Buttons</H1>
</CENTER>

<OBJECT ID="DAControl"
  STYLE="position:absolute; left:20; top:100; width:300; height:275;"
  CLASSID="CLSID:B6FFC24C-7E13-11D0-9B47-00C04FC2F51D">
</OBJECT>

<input type=button value="Canyon" name="CanyonButton" 
  STYLE="position:absolute; left:20; top:375;width:75;height:30">
<input type=button value="Kids" name="KidsButton"
  STYLE="position:absolute; left:123; top:375;width:75;height:30">
<input type=button value="Ocean" name="OceanButton"
  STYLE="position:absolute; left:245; top:375;width:75;height:30">

<DIV STYLE="position:absolute; left:330; top:100;width:50%;">
This sample demonstrates the switcher/switching functionality,
in this case image and sound behaviors are switched
to new values in reaction to button clicks.
</DIV>

<SCRIPT LANGUAGE="VBScript">
<!--
  '  Set import bases.
  mediaBase = "..\..\..\..\media\"
  imgBase = mediaBase + "image\"
  sndBase = mediaBase + "sound\"

  Set m = DAControl.PixelLibrary
  Dim canyonImg, kidsImg, oceanImg
  Dim canyonSnd, kidsSnd, oceanSnd
  '  Import the image and sound.
  Set canyonImg = m.ImportImage(imgBase + "foliageUtah.jpg")
  Set kidsImg = m.ImportImage(imgBase + "kidsUtah.jpg")
  Set oceanImg = m.ImportImage(imgBase + "hiddenBeachSG.jpg")
  Set canyonSnd = m.ImportSound(sndBase + "earth.mp2").Sound.Loop()
  Set kidsSnd = m.ImportSound(sndBase + "torain.mp2").Sound.Loop()
  Set oceanSnd = m.ImportSound(sndBase + "wave.mp2").Sound.Loop()

  Set imgSw = m.ModifiableBehavior(canyonImg)
  Set sndSw = m.ModifiableBehavior(canyonSnd)

Sub window_onLoad

  ' Set image and sound.
  DAControl.Image = m.Overlay(imgSw,m.SolidColorImage(m.Blue))
  DAControl.Sound = sndSw

  ' Set the background in case of a non-windowless browser (like IE3)
  DAControl.BackgroundImage = m.SolidColorImage(m.Blue)

  ' Start the animation
  DAControl.Start

End Sub

Sub CanyonButton_OnClick
  imgSw.SwitchTo(canyonImg)
  sndSw.SwitchTo(canyonSnd)
End Sub

Sub KidsButton_OnClick
  imgSw.SwitchTo(kidsImg)
  sndSw.SwitchTo(kidsSnd)
End Sub

Sub OceanButton_OnClick
  imgSw.SwitchTo(oceanImg)
  sndSw.SwitchTo(oceanSnd)
End Sub
-->
</SCRIPT>
</FONT>
</BODY>
</HTML>
