Package | sekati.ui |
Class | public class Scroll |
See also
Property | Defined by | ||
---|---|---|---|
isDragging : Boolean [read-only]
Check if bar is being dragged.
| Scroll | ||
isMouseInArea : Boolean [read-only]
Check if Mouse is in scrollable area.
| Scroll | ||
isScrollable : Boolean [read-only]
Check if content is scrollable.
| Scroll |
Method | Defined by | ||
---|---|---|---|
Scroll(content:DisplayObject, scrollArea:DisplayObject, gutter:Sprite, bar:Sprite, axis:String = "y", isInit:Boolean = true, hasMouseWheel:Boolean = true, isProportionalGutter:Boolean = true, isProportionalBar:Boolean = true, ease:String = "easeOutExpo", contentSizeTracker:DisplayObject = null, friction:Number = 0.8, ratio:Number = 0.5)
Scroll Constructor
| Scroll | ||
destroy():void
Cleanly destroy Scroll instances.
| Scroll | ||
init():void
Initialize scroll behavior: define confines, mouseWheel, and set scroller to rollout color state.
| Scroll | ||
moveAmount(amount:Number, sec:Number):void
Tween the scroll
_bar by a certain amount. | Scroll | ||
moveBar(pos:Number, sec:Number):void
Tween
_bar to position, _content will reposition accordingly. | Scroll | ||
moveContent(pos:Number, sec:Number):void
Tween to a position within the
_content , scroll _bar will reposition accordingly. | Scroll | ||
movePercent(contentPercent:Number, sec:Number):void
Tween the scroll
_bar by the specified percentage of the total content. | Scroll | ||
reset():void
Reset the Scroll and content positioning and reinitialize.
| Scroll | ||
stopScroll():void
Stop all scrolling motions
| Scroll |
Method | Defined by | ||
---|---|---|---|
barDownHandler(e:MouseEvent):void
Bar Press - start bar drag: register a pseudo
onReleaseOutside event listener on stage.
| Scroll | ||
barUpHandler(e:MouseEvent):void
Bar Release - stop bar drag: unregister a pseudo
onReleaseOutside event listener from stage.
| Scroll | ||
enterFrame(e:Event):void
EnterFrame runs the core scroll logic.
| Scroll | ||
gutterClickHandler(e:MouseEvent):void
Gutter clicks.
| Scroll | ||
mouseWheelHandler(e:MouseEvent):void
MouseWheel handler for
MouseEvent.MOUSE_WHEEL or mac ExternalMouseEvent.MOUSE_WHEEL . | Scroll | ||
resolvePosition(pos:Number):Number
ResolvePosition insure that the scroller moves within its gutter boundaries.
| Scroll | ||
setConfines():void
Store the scrollable confines & resize the bar and gutter if necessary.
| Scroll | ||
setMouseWheel():void
Initialize Mac/PC compatible MouseWheel support.
| Scroll | ||
updateConfines():void
Set content related confines (isloated from setConfines as this may need to be called upon content size changes).
| Scroll |
Constant | Defined by | ||
---|---|---|---|
MOVE_PERCENT : Number = 0.05 [static]
Default percentage of content to tween by in
move methods. | Scroll | ||
MOVE_TIME : Number = 0.2 [static]
Default tween duration, in second, in
move methods. | Scroll |
isDragging | property |
isDragging:Boolean
[read-only]Check if bar is being dragged.
Implementation public function get isDragging():Boolean
isMouseInArea | property |
isMouseInArea:Boolean
[read-only]Check if Mouse is in scrollable area.
Implementation public function get isMouseInArea():Boolean
isScrollable | property |
isScrollable:Boolean
[read-only]Check if content is scrollable.
Implementation public function get isScrollable():Boolean
Scroll | () | constructor |
public function Scroll(content:DisplayObject, scrollArea:DisplayObject, gutter:Sprite, bar:Sprite, axis:String = "y", isInit:Boolean = true, hasMouseWheel:Boolean = true, isProportionalGutter:Boolean = true, isProportionalBar:Boolean = true, ease:String = "easeOutExpo", contentSizeTracker:DisplayObject = null, friction:Number = 0.8, ratio:Number = 0.5)
Scroll Constructor
Parameterscontent:DisplayObject — The scrollable content DisplayObject (Registered 0,0 in its container).
|
|
scrollArea:DisplayObject — The area within which the content is to be scrolled; usually a mask, background or overlay. Also the area within which MouseWheel support is active.
|
|
gutter:Sprite — The clickable, interactive "track" area for the scroll bar (Registered axis 0 in its container).
|
|
bar:Sprite — The object which is dragged or thrown to scroll content inside the viewArea (Registered axis 0 in its container).
|
|
axis:String (default = "y ") — The axis (must be: x || y ) upon which to scroll.
|
|
isInit:Boolean (default = true ) — The (optional) initialization Scroll upon instantiation, otherwise init() must be called manually.
|
|
hasMouseWheel:Boolean (default = true ) — The (optional) enabling of MouseWheel support (both Mac & PC) of the Scroll instance.
|
|
isProportionalGutter:Boolean (default = true ) — The (optional) resizing of the gutter to match the viewArea 's width or height depending on axis .
|
|
isProportionalBar:Boolean (default = true ) — The (optional) resizing of the scroll bar to reflect the viewArea 's scrollable content .
|
|
ease:String (default = "easeOutExpo ") — The Tweener easing equation applied to slideContent, slideScroller or moveScroller calls.
|
|
contentSizeTracker:DisplayObject (default = null ) — The (optional) content size tracking object; used to calculate the viewable scroll area. For use in accordian style content where child objects of content visible property is toggled throwing off the scroll calculations.
|
|
friction:Number (default = 0.8 ) — The motion friction of the content & bar . Note: this does not reflect the motion of slideContent, slideScroller or moveScroller calls.
|
|
ratio:Number (default = 0.5 ) — The motion ratio of the content & bar . Note: this does not reflect the motion of slideContent, slideScroller or moveScroller calls.
|
— if axis is not "x" or "y" & returns without proper instantiation
|
// Scroll(content, scrollArea, gutter, bar, axis, isInit, hasMouseWheel, isProportionalGutter, isProportionalBar, easingEquation, contentSizeTracker, friction, ratio); var scroll:Scroll = new Scroll( content, scrollArea, gutter, bar, "x", true, true, true, true, "easeOutQuint", null, 0.7, 0.4 );
barDownHandler | () | method |
protected function barDownHandler(e:MouseEvent):void
Bar Press - start bar drag: register a pseudo onReleaseOutside event listener on stage.
Parameterse:MouseEvent |
barUpHandler | () | method |
protected function barUpHandler(e:MouseEvent):void
Bar Release - stop bar drag: unregister a pseudo onReleaseOutside event listener from stage.
Parameterse:MouseEvent |
destroy | () | method |
public function destroy():void
Cleanly destroy Scroll instances.
enterFrame | () | method |
protected function enterFrame(e:Event):void
EnterFrame runs the core scroll logic.
Parameterse:Event |
gutterClickHandler | () | method |
protected function gutterClickHandler(e:MouseEvent):void
Gutter clicks.
Parameterse:MouseEvent |
init | () | method |
public function init():void
Initialize scroll behavior: define confines, mouseWheel, and set scroller to rollout color state.
mouseWheelHandler | () | method |
protected function mouseWheelHandler(e:MouseEvent):void
MouseWheel handler for MouseEvent.MOUSE_WHEEL
or mac ExternalMouseEvent.MOUSE_WHEEL
.
e:MouseEvent |
moveAmount | () | method |
public function moveAmount(amount:Number, sec:Number):void
Tween the scroll _bar
by a certain amount. Useful when scroll UI arrows are required.
amount:Number — of pixels to move: positive or negative.
|
|
sec:Number — tween duration in seconds.
_myScroll.moveAmount( -100 );
|
moveBar | () | method |
public function moveBar(pos:Number, sec:Number):void
Tween _bar
to position, _content
will reposition accordingly.
pos:Number — the position to slide scroller on axis.
|
|
sec:Number — the tween duration in seconds.
|
moveContent | () | method |
public function moveContent(pos:Number, sec:Number):void
Tween to a position within the _content
, scroll _bar
will reposition accordingly.
pos:Number — the position to slide content on axis.
|
|
sec:Number — the tween duration in seconds.
|
movePercent | () | method |
public function movePercent(contentPercent:Number, sec:Number):void
Tween the scroll _bar
by the specified percentage of the total content.
contentPercent:Number — of total content (e.g. MyScroll.movePercent(.1); // increases position by 10% ).
|
|
sec:Number — (Number) optional tween duration in seconds
|
reset | () | method |
public function reset():void
Reset the Scroll and content positioning and reinitialize.
resolvePosition | () | method |
protected function resolvePosition(pos:Number):Number
ResolvePosition insure that the scroller moves within its gutter boundaries.
Parameterspos:Number |
Number |
setConfines | () | method |
protected function setConfines():void
Store the scrollable confines & resize the bar and gutter if necessary.
setMouseWheel | () | method |
protected function setMouseWheel():void
Initialize Mac/PC compatible MouseWheel support.
stopScroll | () | method |
public function stopScroll():void
Stop all scrolling motions
updateConfines | () | method |
protected function updateConfines():void
Set content related confines (isloated from setConfines as this may need to be called upon content size changes).
MOVE_PERCENT | constant |
protected static const MOVE_PERCENT:Number = 0.05
Default percentage of content to tween by in move
methods.
MOVE_TIME | constant |
protected static const MOVE_TIME:Number = 0.2
Default tween duration, in second, in move
methods.