Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Auto Save and Load Text
ADOxtra for Shockwave Multiuser Server
Clean for reinstall
Scale Vertexlist
M-Trail v1
Director in Other Programs
Moving MIAWs with lingo
Base64 Xtra
Title Bar MIAW
Store and restore Director objects as an XML string
 

 

 

Behavior Volume Control Dial

Added on 4/27/2000

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: BrentMoseley

You can define the following: How much the sprite will rotate when the mouse is moved. How much the volume changes when the sprite rotates. Which direction the sprite rotates in relation to mouse movement. The initial volume of the sound channel and of course, which sound channel to change.

--created April 26th, by Brent Moseley.
--brent099@xoommail.com

property mysprite
property startrot
property startsound
property clicked
property startv

property motiondiv
property mychannel
property volmult
property inversed
property initvol

on beginsprite me
  mysprite = the spritenum of me
  startrot = the rotation of sprite mysprite
  the volume of sound mychannel = initvol
end

on mousedown me
  startrot = the rotation of sprite mysprite
  startv = the mousev
  startsound = the volume of sound mychannel
  clicked = true
end

on prepareframe me
  if the mousedown = true then
    if clicked = true then
      
      if inversed = false then  --sets DIST to the distance the mouse has moved divided by motiondiv.
        dist = (startv - the mousev) / motiondiv
      else
        dist = (the mousev - startv) / motiondiv
      end if
      
      
      the rotation of sprite mysprite = startrot + dist  --adds DIST to the sprite"s starting rotation.
      
      --sets the volume to the starting volume + the amount the sprite has rotated * volmult.
      the volume of sound mychannel = startsound + ¬
      ((the rotation of sprite mysprite - startrot) * volmult)
      
    end if
  else if clicked = true then
    clicked = false
  end if
end




on getPropertyDescriptionList me
  set pdlist to [:]
  addprop pdlist, #motiondiv, [#comment:"mouse movement to sprite rotation ratio.¬
smaller is faster", #format:#float, #default:2]
  addprop pdlist, #volmult, [#comment:"volume change to sprite rotation ratio.¬
heigher is more drastic", #format:#float, #default:3]
  addprop pdlist, #inversed, [#comment:"reverse rotation direction.", #format:#boolean, #default:0]
  addprop pdlist, #mychannel, [#comment:"sound channel", #format:#integer, #default:1]
  addprop pdlist, #initvol, [#comment:"Initial volume level.", #format:#integer, #default:255, #range:[#min: 0, #max: 255]]
  return pdlist
end getPropertyDescriptionList


on getBehaviorDescription
  return "Volume control dial." & return & return & ¬
"Changes the volume of a sound channel based on the rotation of a sprite." & return & return &¬
"Drop onto a sprite and select the sound channel to change."
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail