|
|
 |
|
|
|
|
|
Creating a conventional scrollbar with dragable slider
1.Create a shape(rectangle) and name it textbox for example.Fill this shape with white color and add line for this shape.
2.Now create your text and name it myText.Place the text over your shape.Select shape (textbox) and text(myText) and group them as sprite.Add some name for this sprite(mySprite) and click "group bottom object as mask".
3.Open sprite and select the shape (rectangle).Copy this shape, click on the scene_1 and paste it.Drag this new shape over the first shape and click Fill/None.
4.Copy this new shape again, click on Scene_1 and click paste in place.Add name track and scale it (from left to right ), like the picture below (this is the track where you will now place and after move your slider):

Creating buttons:
5.Create a new small shape (rectangle) and with "reshape" tool create an arrow (name it up).Drag this shape and position it like in the picture below.Copy this shape and click paste in place.With this new shape still selected goto in Modify/Transform and click Rotate 180.

6.Name this shape down, select it and with keyboard down arrow position it like in the picture above.
7.Now select the shape named up and click Modify/Grouping/Group as Button and name it up.Do the same for the down shape.
8.Now create new shape (rectangle) like the picture below and name it slider.Position this shape like the picture below.

9.Now select up button, down button and slider, and group as sprite(name it buttons).
// select this objects by pressing ctrl on the keyboard and clicking each of this object in the Scene_1 tree//
Scripting:
10.Now select the sprite buttons and add this script:
onLoad () { up="false"; down="false"; } onEnterFrame() { if ((up eq "true") && (_root.mySprite.myText._y < 3)) { _root.mySprite.myText._y += 2; } else if ((down eq "true") && (_root.mySprite.myText._y > -135 )) { _root.mySprite.myText._y -= 2; } } onEnterFrame() { if ((down eq "true")&&(_root.buttons.slider._y < 65)){ _root.buttons.slider._y += 2; }else if ((up eq "true")&&(_root.buttons.slider._y > -65)){ _root.buttons.slider._y -= 2; } }
11.Open buttons sprite, click on the up button and add script:
on (press) { up="true"; } on (release) { up="false"; }
12.Click on the down button and add this script:
on (press) { down="true"; } on (release) { down="false"; }
13.Now click on the slider and add script:
on (press) { thsY = this._y; slider.startDragLocked(0,0,-65,65); } on (release) { stopDrag(); }
14.Now click on the Scene_1 and add script:
onEnterFrame(includingFirstFrame) { NegY =(-65 - _root.buttons.slider._y); NewY = NegY * 1.1; _root.mySprite.myText._y =math.round (NewY); }
15.That's all! Now test your scrollbar and ENJOY.
Preview:
Conventional Scrollbar
Download Example
|
|
|
|