IScrollable
Scroll handles mouseWheel (PC & Mac), dynamic resizing of content, external size tracking for accordian style content scrolling, slideContent method, modal ui states, proportional bar, gutter and more.
Usage: var _scroll:Scroll = Scroll("_y", contentMc, maskMc, gutterMc, barMc, true, true, true, true); var _scroll:Scroll = Scroll ("_y", contentMc, maskMc, gutter, bar, true, true, true, true, contentMc, .8, .5);
new Scroll()
public function Scroll(axis:String, content:Object, mask:MovieClip, gutter:MovieClip, bar:MovieClip, isResizeGutter:Boolean, isResizeBar:Boolean, isMouseWheel:Boolean, isInit:Boolean, contentSizeTracker:Object, friction:Number, ratio:Number)
Constructor
axis | (String) axis the scroller will scroll on: must be "_x" or "_y" |
content | (Object) content object |
mask | (MovieClip) content mask |
gutter | (MovieClip) gutter object |
bar | (MovieClip) scroller bar object |
isResizeGutter | (Boolean) optional resize gutter to content mask |
isResizeBar | (Boolean) optional resize bar proportional to content |
isMouseWheel | (Boolean) optional enable mouseWheel scrolling (one may choose to use 2 instances of Scroll for hscroll & vscroll and only want vscroll in which case mouseWheel should only be enabled for one instance) |
isInit | (Boolean) optional init scroller upon instantiation, else init() must be called manually |
contentSizeTracker | (Object) optional object used to track content size. Useful in accordian content where visibility or masking is used to hide partial content [default: content] |
friction | (Number) optional scroll motion friction [default 0.8] |
ratio | (Number) optional scroll motion ratio [default 0.5] |
Void
Error | if axis is not "_x" or "_y" & returns without proper instantiation
Usage: var scroll:Scroll = new Scroll("_x", contentMc, maskMc, gutterMc, barMc, true, true, true, true, contentMc, 0.7, 0.4); |
public function slideContent(pos:Number, sec:Number):Void
Tween content to position, scroller will reposition accordingly.
pos | (Number) position to slide content on axis |
sec | (Number) optional tween duration in seconds [default: 0.5] |
Void
public function slideScroller(pos:Number, sec:Number):Void
Tween bar to position, content will reposition accordingly.
pos | (Number) position to slide scroller on axis |
sec | (Number) optional tween duration in seconds [default: 0.5] |
Void
public function moveScroller(amount:Number):Void
Move the scroller bar by a certain amount
amount | (Number) pixels to move: positive or negative |
Void
_myScroll.moveScroll( -100 );
public function isScrollable():Boolean
Check if content is scrollable.
Boolean
public function isMouseInArea():Boolean
Check if Mouse is in scrollable area.
Boolean
public function destroy():Void