Package | gs.display |
Class | public final class ScrollBar |
var scrollBar:ScrollBar = new ScrollBar(stage,content,contentMask,handle,track,upArrow,downArrow); var scrollBar2:ScrollBar = new ScrollBar(stage,content2,contentMask2,handle2,track2,leftArrow,rightArrow,ScrollBar.HORIZONTAL);
If the content clip contains only one textfield, and the autoSize property is set to "none," the scrollbar set's it to "left" otherwise the height of the content clip is incorrect.
The ScrollBar uses initial property values from the clips you provide, to calculate offsets, max y, and min y, and also for resetting. So the clips must be laid out exactly how they are to be used. Otherwise you'll see weird offsets, which aren't correct.
Examples are in the guttershark repository.
Property | Defined by | ||
---|---|---|---|
allowTrackClick : Boolean
Whether or not to allow track clicks.
| ScrollBar | ||
arrowsStep : Number = 5
The amount of pixels to move the handle, when the
up, down, left or right arrow is clicked.
| ScrollBar | ||
direction : String
The scroll direction, can be ScrollBar.VERTICAL (default), or ScrollBar.HORIZONTAL.
| ScrollBar | ||
easeSpeed : Number = .4
Scrolling ease speed.
| ScrollBar | ||
wheelStep : Number = 5
The amount of pixels to move the handle, when the
mouse wheel is used.
| ScrollBar |
Method | Defined by | ||
---|---|---|---|
ScrollBar(stage:Stage, content:Sprite, contentMask:Sprite, handle:Sprite, track:Sprite, upOrLeftArrow:Sprite = null, downOrRightArrow:Sprite = null, direction:String = "vertical", allowTrackClick:Boolean = true, autoScrollOnArrowsDown:Boolean = true)
Constructor for ScrollBar instances.
| ScrollBar | ||
dispose():void
Dispose of this scroll bar.
| ScrollBar | ||
resetHandlePosition():void
Resets the handle x and y position to the very
first positions that were used when the scrollbar
was created, but does not trigger a scroll update.
| ScrollBar |
Constant | Defined by | ||
---|---|---|---|
HORIZONTAL : String = "horizontal" [static]
Horizontal scrollbar mode.
| ScrollBar | ||
VERTICAL : String = "vertical" [static]
Vertical scrollbar mode.
| ScrollBar |
allowTrackClick | property |
public var allowTrackClick:Boolean
Whether or not to allow track clicks.
arrowsStep | property |
public var arrowsStep:Number = 5
The amount of pixels to move the handle, when the up, down, left or right arrow is clicked.
direction | property |
direction:String
[read-write]The scroll direction, can be ScrollBar.VERTICAL (default), or ScrollBar.HORIZONTAL.
Implementation public function get direction():String
public function set direction(value:String):void
easeSpeed | property |
public var easeSpeed:Number = .4
Scrolling ease speed.
wheelStep | property |
public var wheelStep:Number = 5
The amount of pixels to move the handle, when the mouse wheel is used.
ScrollBar | () | constructor |
public function ScrollBar(stage:Stage, content:Sprite, contentMask:Sprite, handle:Sprite, track:Sprite, upOrLeftArrow:Sprite = null, downOrRightArrow:Sprite = null, direction:String = "vertical", allowTrackClick:Boolean = true, autoScrollOnArrowsDown:Boolean = true)
Constructor for ScrollBar instances.
Parametersstage:Stage — A stage reference, needed for mouse events.
|
|
content:Sprite — The content clip.
|
|
contentMask:Sprite — The content mask clip.
|
|
handle:Sprite — The scrollbar handle clip.
|
|
track:Sprite — The scrollbar track clip.
|
|
upOrLeftArrow:Sprite (default = null ) — An arrow button that causes up or left scrolling.
|
|
downOrRightArrow:Sprite (default = null ) — An arrow button that causes down or right scrolling.
|
|
direction:String (default = "vertical ") — The direction for scrolling, horizontal or vertical.
|
|
allowTrackClick:Boolean (default = true ) — Whether or not to allow clicking on the scroll track.
|
|
autoScrollOnArrowsDown:Boolean (default = true ) — Whether or not to auto scroll when the mouse is pressed down,
and held, over an arrow button.
|
dispose | () | method |
public function dispose():void
Dispose of this scroll bar.
resetHandlePosition | () | method |
public function resetHandlePosition():void
Resets the handle x and y position to the very first positions that were used when the scrollbar was created, but does not trigger a scroll update.
HORIZONTAL | constant |
public static const HORIZONTAL:String = "horizontal"
Horizontal scrollbar mode.
VERTICAL | constant |
public static const VERTICAL:String = "vertical"
Vertical scrollbar mode.