Back to Previous

Scrollers

This activity/behavior demonstrates the ability to move a sprite via mouse click to a graphic it is attached to. I originally developed the "Move Sprite Via Click" behavior to move form fields up and down in conjunction with my "Follow the Leader" behavior so that the end result would be page scrolling of a group of many items.

As you know director really doesn't have a good way to scroll items in a way to simulate a frameset or scrolling page so this is a way to fake it .

The "Follow the Leader" behavior is another behavior of mine that presents you with an option to choose a "leader" in which all sprites of the set will follow. This is somewhat of a modified version of Director's native "multiple sprite drag" behavior. The green square below is using the "Follow The Leader" behavior.

The yellow rectangle in the example below has director's native "constrain sprite" behavior attached. This works well as a quick and dirty way to constrain a sprite/s. You'll want to make the rectangle's border invisible in your own projects though. I have left it on below so you can see how it limits the movement. As you tell, the ends of the constraining rectangle are just off screen.

If you would like to use a more elaborate scroller with a scroller track as well as buttons see the "Scroll Multiple Sprites Via Slider" behavior and example (2 examples further down).

__________________________________________________________

This example is similar to the one above except it uses my "Move Sprite Via Rollover" behavior. This Behavior will ask for a left, right, up and downrollover buttons that you are wanting to be the triggers of the direction.

__________________________________________________________

This behavior is a more robust version of the move sprite via mouse click activity, as it requires no fewer than 8 behaviors. However, it will simulate a OS scroll bar complete with highlighting arrows and a draggable scrolling thumb track. These behaviors require a little more finessing then just moving sprites via mouse click, but if you stick with it, you can create a pretty convincing scroll bar that simulates those scrollers found in your operating system. Credit for the first 4 behaviors can be given to the folks of director-online.com

The scrollbar uses the following behaviors:
(non-bolded behaviors come already in director)

Special thanks is given to George Tomek who worked to further improve the scroller thumb behavior so that it allows for a command to happen when the thumb scroller reaches a certain place of the thumb track (basically a hotspot-this is optional)

Since this scroller is nothing more than sprites with behaviors attached, you can be free to design their look to be anything you want.