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
Authorware 5 Attain Authorized
Table
Delet an Existing File
VideoCodecCheck
DirectTransition
Mac Drive
Follow me
Sin Path Movement
Text Drop Shadows (and a moving light)
Font Size DropDown
 

 

 

Behavior Volume Slider

Added on 9/14/1999

 

Compatibilities:
behavior D6_5 D7 D8 Mac PC

This item has not yet been rated

Author: MichaelNadel

Volume Slider

Download PC Source    Download Mac Source
--Created by Michael Nadel
-- DESCRIPTION --

on getBehaviorDescription me
  return "¬
VOLUME BEHAVIOR" &RETURN&RETURN&"¬
Allows you to make your own custom Volume Bar with just 2 sprites."&RETURN&RETURN&"¬
This behavior will also set the position of the adjustable bar to it's appropriate position¬
automatically at initialization."&RETURN&RETURN&"¬
When this behavior is dropped onto a sprite you will be asked to define 3 main variables:"&RETURN&"¬
1) The sprite that you want to use as the Axis (or the constraint) for the movable bar. "&RETURN&"¬
2) The sprite that you want to use as the movable bar."&RETURN&"¬
3) The Direction of the Axis bar (i.e.the direction the user drags the volume bar)."&RETURN&RETURN&"¬
You will also be asked to define 4 additional features. "&RETURN&"¬
Note: these features are not selected by default because they are only optional."&RETURN&"¬
1) If you would, or would not, like to put the soundlevel into a field (for the user to view on the stage)."&RETURN&"¬
2) If  Put SoundLevel into Field is checked then you are asked to define the name of the field that you would like to put the soundlevel into."&RETURN&"¬
3) If you would, or would not, like the volume bar to make a sound on MouseUp (a useful indication of the volume change)."&RETURN&"¬
4) If  Make a Sound on MouseUp is selected then you are asked to define the name of the sound member."&RETURN&RETURN&"¬
Tips:"&RETURN&RETURN&"¬
1) This behavior should be attached to both the axis, the scroll bar and whatever other graphic is associated with the volume control.¬
This way, if the user clicks on either one, the volume will be automatically adjusted."&RETURN&"¬
2) You can make any interface you want for the volume control, just make an invisible draw sprite to be your constraint."&RETURN&"¬
3) In case you use a visible constraint sprite, you should make sure that you use a bitmap as the scroll bar and not a quickDraw sprite¬
because a quickDraw sprite's registration point is in the top left corner."&RETURN&RETURN&"¬
This Behavior was created by Michael Nadel on 9/3/99 and is free for distribution."&RETURN&"¬
Write to mims@barak-online.net for comments."
end getBehaviorDescription


Property pConstraint, pBar, pDirection
Property pText, pTextName, pSound, pSoundName


on getPropertyDescriptionList me
  set pdlist to [:]
  addprop pdlist,  #pConstraint, [#comment:"Constraint Sprite", #format:#integer, #default:3]
  addprop pdlist, #pBar, [#comment:"Bar Sprite", #format:#integer, #default:4]
  addprop pdlist, #pDirection, [#comment:"Direction", #format:#symbol, #default:#Verticle, #range:[#Verticle,#Horizontal]]
  addprop pdlist,  #pText, [#comment:"Put the SoundLevel into Feild" & RETURN, #format:#boolean, #default:0]
  addprop pdlist,  #pTextName, [#comment:"Feild Member Name", #format:#symbol, #default:#Volume]
  addprop pdlist,  #pSound, [#comment:"Make a Sound on MouseUp" & RETURN, #format:#boolean, #default:0]
  addprop pdlist,  #pSoundName, [#comment:"Sound Member Name", #format:#symbol, #default:#ding]
  return pdlist
end getPropertyDescriptionList


on beginSprite me  
  set the constraint of sprite pBar to pConstraint  
  --  SETS THE BAR TO IT'S APPROPRIATE POSITION IN ACCORDANCE WITH THE SOUNDLEVEL  
  case pDirection of
    #Verticle: set the locv of sprite pBar=((the bottom of sprite pConstraint)-((the soundlevel-1)*(the height of sprite pConstraint)/7))
    #Horizontal:set the loch of sprite pBar=((the left of sprite pConstraint)+((the soundlevel-1)*(the width of sprite pConstraint)/7))
  end case  
  if pText=1 then
    put the soundlevel into member string(pTextName)
  end if  
end

on mouseDown  
  repeat while the stilldown    
    case pDirection of        
      #Verticle:  
        set the locv of sprite pBar to the mousev
        set the soundLevel=(((the bottom of sprite pConstraint)-(the locv of sprite pBar))/((the height of sprite pConstraint)/7))+1        
      #Horizontal:
        set the loch of sprite pBar to the mouseh
        set the soundLevel=(((the loch of sprite pBar)-(the left of sprite pConstraint))/((the width of sprite pConstraint)/7))+1        
    end case    
    if pText=1 then
      put the soundlevel into member string(pTextName)
    end if    
    updatestage
  end repeat  
  if pSound=1 then
    puppetsound member string(pSoundName)
  end if  
end

 


Contact

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

Send e-mail