Represent a button that manage a ScrollBar
by being dragged.
public function ScrollDragButton(scroller:MovieClip, scrollerBackground:MovieClip, type:ScrollType, backgroundScrollValue:Number, autoAdjust:Boolean, autoHide:Boolean, alwaysResize:Boolean, alwaysRefresh:Boolean)
Create a new ScrollDragButton.
scroller | The clip scroller. |
type | The ScrollType to use.
|
backgroundScrollValue | Scroll value on the press on the background (<=0 means that the scroller scrolls directly to the mouse position). |
autoAdjust | If the scroller should adjust automatically. () |
autoHide | If the scroller should automatically hide. |
alwaysResize | If the scroller should be resized at all events. |
alwaysRefresh | If a refresh event must be dispatched when the mouse is pressed. |
Error | If scroller is null .
|
Error | If scrollerBackground is null .
|
Error | If type is null .
|
Error | If backgroundScrollValue is null .
|
static public NORMAL_MODE:Number [Read Only]
Constant value : 0.
static public REVERSE_MODE:Number [Read Only]
Constant value : 1.
static public SPEED_SCROLL:Number [Read Only]
autoScroll
delay
is over. The scroll value can be adjusted with the
backgroundScrollValue
variable.
Constant value : 40.
public backgroundScrollValue:Number
Specifies the value to scroll when the user press on the background of the scroller.
If this value is less than or equal to 0, the scroller will be direct scrolled to the mouse position.
public autoScroll:Number
This value is linked with the TIME_SCROLL
value. It specifies
how many milliseconds to wait before the scroller is automatically
scrolled when the user press the background.
By default, this value is 400.
public minimumSize:Number
autoAdjust
property is true
.
public maximumSize:Number
autoAdjust
property is true
.
public autoAdjust:Boolean
The size of the scroller will be set at the same ratio of
the content whent the refresh()
method will be
invoked.
public autoHide:Boolean
public alwaysResize:Boolean
actionPerformed
event is performed or only when the event is a refresh event.
public alwaysRefresh:Boolean
public function setEnabled(value:Boolean):Void
Set if the ScrollDragButton
is enabled or not.
value | true to enable the ScrollDragButton , false otherwise.
|
setEnabled() in ch.component.scrollbar.AbstractScrollBarManager
public function getBackground(Void):MovieClip
Get the background of the scroller.
The background.
public function setMode(mode:Number):Void
Set the mode.
The mode set how the ScrollDragButton
must move. By normal mode,
it will move up-down or left-right. By reverse mode, it will move down-up or
right-left. This method automatically replace the scroller at his right place,
depending on the current ratio, calling the setRatio
method.
If the mode
is the same as the current mode, nothing append.
mode | NORMAL_MODE or REVERSE_MODE .
|
Error | If mode is invalid.
|
public function scrollPerformed(event:ScrollEvent):Void
Method called when a scroll is performed on a ScrollBarModel
.
event | The event object. |
public function getContentRatio(Void):Number
Get the size ratio between the content and the background.
The size ratio of the content.
public function resize(size:Number):Void
Resize the scroller to the specified size.
size | The size for the scroller. |
public function isDragged(Void):Boolean
Get if this ScrollDragButton
is being dragged.
true
if the scroller is being dragged.
public function isBackgroundPressed(Void):Boolean
Get if the background is pressed.
true
if the background is pressed.
public function setRatio(ratio:Number):Void
Set the ratio of the scroller.
Calling this method won't affect the linked ScrollBar
! It only
will move the scroller to the specified ratio, using the scrollTo
method.
When you want to adjust the ScrollBar
linked to the ScrollDragButton
,
use the adjust
method.
Note that a ScrollDragButton
in NORMAL_MODE
or
in REVERSE_MODE
will not be set at the same place within the same value. The
ScrollDragButton
in REVERSE_MODE
will be automatically adjusted !
ratio | A Number between 0 and 1 inclusive.
|
public function getRatio(Void):Number
Get the ratio of the scroller.
Note that a ScrollDragButton
in NORMAL_MODE
or
in REVERSE_MODE
will return the same value !
A Number
between 0 and 1 inclusive.
public function scrollTo(target:MovieClip, property:String, value:Number):Void
Scroll to the specified value. This method moves directly the target clip property to the specified valu.
target | The target clip. |
property | The property to affect. |
value | The position. |
public function onScrollerReleaseOutside(Void):Void
Action onReleaseOutside of the clip.
public function onBackgroundRelease(Void):Void
Action onRelease of the background.
public function onBackgroundReleaseOutside(Void):Void
Action onReleaseOutside of the background.
public function toString(Void):String
Represent the current instance into a String.
A String representing the ScrollDragButton instance.
toString() in ch.component.scrollbar.AbstractScrollBarManager