Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Multiple-timer facility
Reference Xtra
moving buttons
Frogger by J.R.D.R.
Color Picker
PrintOMatic
Vector Shape - Create Rectangle
RavJoystick Xtra
Microangelo
Moka Xtra
MediaMacros Xtras Mall
 

 

 

Behavior Volume Control Behavior

Added on 8/8/2000

 

Compatibilities:
behavior D7 D8 Mac PC

This item has not yet been rated

Author: Shehal (website)

use this behavior to specify which is the thumb and which is the slide bar

-- use this behavior to specify which is the thumb and which is the slide bar
-- visit my shockwave site
-- http://www.unixville.com/~shehal/
-- mailto: shehal@mediasolv.com
-- I work for MediaSolv.com
-- visit RISSA"s site
-- http://www.geocities.com/~marissaj/

global thumbSprite
global thumbWidth
global slideBarSprite
global slideBarLength
global maxX -- right corner of thumb
global minX -- left  corner of thumb
global Y -- the vertical position of slide bar
global leftLimit
global rightLimit

property controlObject
property canDragNow
property volumeLevel

on beginSprite me
  case controlObject of
    "thumb":
      thumbSprite = sprite(me.spriteNum)
      member(thumbSprite.member).centerRegPoint = 1
      thumbWidth = thumbSprite.width
      thumbSprite.locV = Y
    "slide bar":
      slideBarSprite = sprite(me.spriteNum)
      member(slideBarSprite.member).centerRegPoint = 1
      slideBarLength = slideBarSprite.width
      maxX = (slideBarSprite.locH) + (slideBarLength / 2) - (thumbWidth / 2)
      minX = (slideBarSprite.locH) - (slideBarLength / 2) + (thumbWidth / 2)
      Y = slideBarSprite.locV
  end case
end beginSprite

on mouseDown me
  canDragNow = 1
end mouseDown

on mouseWithin me
  if canDragNow = 1 then
    if (the mouseH < maxX) AND (the mouseH > minX) then
      set thumbSprite.locH = the mouseH
      X = thumbSprite.locH
      volumeLevel = 7*(pi()*(X-minX))/(pi()*(maxX-minX))
      set the soundLevel to integer (volumeLevel)
    else
      if (the mouseH = maxX) then
        set thumbSprite.locH = maxX
        volumeLevel = 7
        set the soundLevel to integer (volumeLevel)
      else
        if (the mouseH = minX) then
          set thumbSprite.locH = minX
          volumeLevel = 0
          set the soundLevel to integer (volumeLevel)
        end if
      end if
    end if
  end if
end mouseWithin

on mouseUp me
  set canDragNow = 0
end mouseUp

on mouseLeave me
  set canDragNow = 0
end mouseLeave

on getPropertyDescriptionList
  set description = [:]
  addProp description,#controlObject, [#default: "thumb", #range: ["thumb", "slide bar"], #format:#string, #comment:"What is this Sprite ?"]
  return description
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail