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
Application Xtra
Volume Slider
Generic Slider w/Text
WinGroup Xtra
Learning Lingo : The Art and Science of Programming With Macromedia Director
Macromedia Director 8 Shockwave Studio- Illustrated Introductory
ToolTipper
Yes/No Dialog Box
Set PlayBackMode Property of a Animated Gif Sprite
Remove border behavior
 

 

 

Behavior Scroll Buttons

Added on 6/7/1999

 

Compatibilities:
behavior D6_5 Mac PC

This item has not yet been rated

Author: PatMcClellan

For use with the Scroll Thumb, Scroll Thumb Track, and the Scrollable Sprites behaviors This behavior allows the author to select direction for which the button (sprite) will act upon the slider thumb. It uses a global variable which is accessed by the opposite scroll button, as well as the thumb and other sprites which will be scrolled.

property pMyDirection -- options are UP, DOWN, LEFT & RIGHT
property pThumbSprite  -- sprite number of the corresponding scroll thumb
property pThumbRange -- range of motion for the scroll thumb sprite
property pMyIncrement -- converts pMyDirection to an integer value
global gScrollV  -- amount scroll has been incremented Vertically from initial value
global gScrollH  -- amount scroll has been incremented Horizontally from initial value

on getPropertyDescriptionList
  set directionList = [#UP, #DOWN, #LEFT, #RIGHT]
  set p_list = [¬
  #pMyDirection: [ #comment:   "Direction of Button Arrow",¬
  #format:   #symbol,¬
  #range:    directionList,¬
  #default:   #UP]¬
  ]
  return p_list
end

on beginSprite me
  case pMyDirection of     -- converts string direction into integer increment
    #UP: set pMyIncrement = -1
    #DOWN: set pMyIncrement = 1
    #LEFT: set pMyIncrement = -1
    #RIGHT: set pMyIncrement = 1
  end case
end

on setThumbV me, range, thumbSprite
  if pMyDirection = #UP or pMyDirection = #DOWN then
    set pThumbRange = range
  end if
  set pThumbSprite = thumbSprite
end

on setThumbH me, range, thumbsprite
  if pMyDirection = #LEFT or pMyDirection = #RIGHT then
    set pThumbRange = range
  end if
  set pThumbSprite = thumbSprite
end

on mouseDown me
  case pMyDirection of
    #UP:
      repeat while the stillDown and gScrollV > 0
        set gScrollV = gScrollV + pMyIncrement
        sendSprite(pThumbSprite, #ScrollThumbV)
        sendAllSprites(#ScrollV)
        updateStage
      end repeat
    #DOWN:
      repeat while the stillDown and gScrollV < pThumbRange
        set gScrollV = gScrollV + pMyIncrement
        sendSprite(pThumbSprite, #ScrollThumbV)
        sendAllSprites(#ScrollV)
        updateStage
      end repeat
    #LEFT:
      repeat while the stillDown and gScrollH > 0
        set gScrollH = gScrollH + pMyIncrement
        sendSprite(pThumbSprite, #ScrollThumbH)
        sendAllSprites(#ScrollH)
        updateStage
      end repeat
    #RIGHT:
      repeat while the stillDown and gScrollH < pThumbRange
        set gScrollH = gScrollH + pMyIncrement
        sendSprite(pThumbSprite, #ScrollThumbH)
        sendAllSprites(#ScrollH)
        updateStage
      end repeat
  end case
end  

 


Contact

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

Send e-mail