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
Drop-Down Boxes in Director
Larger Graphics in Director than outside
LineHiLiter
Function Key Keycodes
DirectImage Xtra
Drag and Switch
Xtras Mall From MediaMacros
Set ViewScale Property of a Flash Sprite
Flash Sprite Cusor Changing Movie Script
DirectTransition3D Xtra, Set III
 

 

 

Behavior Volume Behaviour (Buttons)

Added on 6/25/2006

 

Compatibilities:
D9 Mac PC

Required Xtras:
Buddy API

This item has not yet been rated

Author: davec1

This is a modified version of the Mediamacros behaviour. I have tweeked it to run on PC/Mac and MX. Drop behaviour on to an up or down volume button. Let me know if you have improved it. Cheers

property theVolume, whichWay, soundNotch, rolloverMember, defaultMember, clickMember, whatVolume, spriteNum, thisSprite

on getPropertyDescriptionList me
thisSprite = the currentSpriteNum
return [#soundNotch : [#format : #integer, #comment : "Number of sound notches:", #default : 10, #range : [#min : 1, #max : 30]], #rolloverMember : [#format : #member, #comment : "Rollover member", #default : (sprite thisSprite).member], #clickMember : [#format : #member, #comment : "Click member", #default : (sprite thisSprite).member], #whatVolume : [#format:#string, #comment : "What sound device?", #default : "Master", #range : ["Master", "CD", "Wave", "Midi", "Synth"]], #whichWay : [#format:#string, #comment : "Which Button", #default : "Up", #range : ["Up", "Down"]]]
end

on mouseEnter me
sprite(me.spriteNum).member = rolloverMember
end

on mouseLeave me
sprite(me.spriteNum).member = defaultMember
end

on mouseDown me
sprite(me.spriteNum).member = clickMember
end

on mouseUp me
sprite(me.spriteNum).member = defaultMember
eachJump = 100.0/soundNotch
if whichWay = "Up" then
newVolume = baGetVolume(whatVolume) + eachJump
if integer(newVolume) >= 100 then
newVolume = 100
end if
else
newVolume = baGetVolume(whatVolume) - eachJump
if integer(newVolume) <=0 then
newVolume = 0
end if
end if
baSetVolume(whatVolume, integer(newVolume))
end

on beginSprite me
theVolume = baGetVolume(whatVolume)
defaultMember = (sprite spriteNum).member
end

on getBehaviorDescription me
describe = "This behavior is similar to the slider sound behavior but involves only an up and down button.  Simply drag and drop and assign which is the up and which is the down button.  Note that the sound notches can be different on this one."
return describe
end

 


Contact

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

Send e-mail