| Package | lunas.components.bars |
| Class | public class SimpleScrollbar |
| Inheritance | SimpleScrollbar CoreScrollbar CoreProgressbar CoreProgress CoreComponent Background CoreSprite flash.display.Sprite |
Example :
import flash.display.StageScaleMode ;
import flash.events.KeyboardEvent ;
import flash.ui.Keyboard
import graphics.Direction ;
import graphics.FillStyle ;
import graphics.LineStyle ;
import graphics.geom.EdgeMetrics ;
import lunas.components.bars.SimpleScrollbar ;
import lunas.events.ButtonEvent ;
import lunas.events.ComponentEvent ;
stage.scaleMode = StageScaleMode.NO_SCALE ;
var change:Function = function( e:ComponentEvent ):void
{
trace( e.type + " : " + bar.position ) ;
}
var bar:SimpleScrollbar = new SimpleScrollbar() ;
addChild(bar) ;
// behaviours of the scrollbar
bar.addEventListener( ComponentEvent.CHANGE , change ) ;
bar.thumbSize = 30 ;
bar.position = 50 ;
bar.x = 50 ;
bar.y = 50 ;
// initialize style of the scrollbar
bar.barFillStyle = new FillStyle( 0x921085 , 1 ) ;
bar.barLineStyle = new LineStyle( 1 , 0x6A9195, 1 ) ;
bar.thumbFillStyle = new FillStyle( 0xB5C7CA , 1 ) ;
bar.thumbLineStyle = new LineStyle( 2 , 0xFFFFFF , 1 ) ;
var shadow:DropShadowFilter = new DropShadowFilter( 1, 45, 0x000000, 0.6, 6, 6, 1, 6) ;
bar.filters = [ shadow ] ;
bar.thumb.filters = [ shadow ] ;
var keyDown:Function = function( e:KeyboardEvent ):void
{
var code:uint = e.keyCode ;
switch( code )
{
case Keyboard.LEFT :
{
bar.position -= 10 ;
break ;
}
case Keyboard.RIGHT :
{
bar.position += 10 ;
break ;
}
case Keyboard.UP :
{
bar.position = bar.minimum ;
break ;
}
case Keyboard.DOWN :
{
bar.position = bar.maximum ;
break ;
}
case Keyboard.SPACE :
{
bar.direction = ( bar.direction == Direction.VERTICAL ) ? Direction.HORIZONTAL : Direction.VERTICAL ;
if ( bar.direction == Direction.VERTICAL )
{
bar.setSize( 8, 200 ) ;
}
else
{
bar.setSize( 200, 8 ) ;
}
}
default :
{
bar.minimum = 20 ; // change the minimum value of the bar
bar.maximum = 80 ; // change the maximum value of the bar
bar.invert = !bar.invert ; // invert the positive direction of the bar scroll.
}
}
}
stage.addEventListener( KeyboardEvent.KEY_DOWN , keyDown ) ;
| Property | Defined By | ||
|---|---|---|---|
![]() | align : uint
The alignement of the background. | Background | |
![]() | autoResetPosition : Boolean
This flag indicates of the position is auto reset. | CoreProgress | |
| autoScroll : Boolean = true
Indicates if the scrollbar scroll with a timer when the buttons are pressed. | SimpleScrollbar | ||
| autoScrollDelay : Number = 500
Indicates the delay is ms when the user click a button to run the auto scrolling (default 500). | SimpleScrollbar | ||
![]() | autoSize : Boolean
Indicates if the background is resizing when the stage resize event is invoked. | Background | |
![]() | bar : Sprite
The bar display of the scrollbar. | CoreScrollbar | |
| barFillStyle : IFillStyle
Determinates the fill style object of the bar. | SimpleScrollbar | ||
| barLineStyle : ILineStyle
Determinates the line style object of the bar. | SimpleScrollbar | ||
![]() | border : EdgeMetrics
Indicates the thickness, in pixels, of the four edge regions around a visual component. | CoreComponent | |
| bottomButton : FrameLabelButton
Indicates the bottom button used when the bar direction is Direction.VERTICAL. | SimpleScrollbar | ||
![]() | bottomLeftRadius : Number
The radius of the bottom-left corner, in pixels. | Background | |
![]() | bottomRightRadius : Number
The radius of the bottom-right corner, in pixels. | Background | |
![]() | bubbles : Boolean = true
Indicates if the events use bubbling when are dispatched. | CoreComponent | |
![]() | builder : Builder
Indicates the Builder reference of this instance. | CoreComponent | |
![]() | componentInspectorSetting : Boolean
Initialize when the Flash component settings are initialized (only in Flash with a compiled component). | CoreComponent | |
| cornerRadius : Number
The global corner radius corner, in pixels (default 0). | SimpleScrollbar | ||
![]() | direction : String
Indicates the direction value of the background when the display is in this "full" mode (default value is null). | Background | |
![]() | enabled : Boolean
Indicates the enabled state of the component. | CoreComponent | |
![]() | fill : IFillStyle
Determinates the IFillStyle reference of this display. | Background | |
![]() | gradientMatrix : Matrix
The matrix value to draw the gradient fill. | Background | |
![]() | gradientRotation : Number = 0
The rotation value to draw the gradient fill. | Background | |
![]() | gradientTranslation : Point
The translation vector to draw the gradient fill. | Background | |
![]() | group : Boolean
Indicates with a boolean if this object is grouped. | CoreComponent | |
![]() | groupName : String
Indicates the name of the group of this object. | CoreComponent | |
![]() | h : Number
Determinates the virtual height value of this component. | Background | |
![]() | invert : Boolean
Indicates if the layout direction of the thumb is invert. | CoreScrollbar | |
![]() | isDragging : Boolean [read-only]
Indicates if the bar is dragging. | CoreScrollbar | |
![]() | isFull : Boolean
Indicates if the background use full size (use Stage.stageWidth and Stage.stageHeight to resize the background). | Background | |
![]() | layout : Layout
Determinates the layout of this container. | CoreComponent | |
| leftButton : FrameLabelButton
Indicates the left button used when the bar direction is Direction.HORIZONTAL. | SimpleScrollbar | ||
![]() | line : ILineStyle
Determinates the ILineStyle reference of this display. | Background | |
![]() | lineScrollSize : Number
Determines how much the scrollbar's value will change when one of the arrow buttons is clicked. | CoreScrollbar | |
![]() | logger : Logger
Determinates the internal ILogger reference of this Logable object. | CoreSprite | |
![]() | maxHeight : Number
This property defined the maximum height of this display. | Background | |
![]() | maximum : Number
The maximum value of this scrollbar. | CoreProgress | |
![]() | maxWidth : Number
Defines the maximum width of this display. | Background | |
![]() | minHeight : Number
This property defined the mimimun height of this display (This value is >= 0). | Background | |
![]() | minimum : Number
The minimum value of this scrollbar. | CoreProgress | |
![]() | minWidth : Number
This property defined the mimimun width of this display (This value is >= 0). | Background | |
| padding : EdgeMetrics
The padding between the arrow buttons and the bar. | SimpleScrollbar | ||
![]() | pageSize : Number
Determines the amount the value will change if the user clicks above or below the thumb. | CoreScrollbar | |
![]() | position : Number
Indicates the position of the progress bar. | CoreProgress | |
| rightButton : FrameLabelButton
Indicates the right button used when the bar direction is Direction.HORIZONTAL. | SimpleScrollbar | ||
![]() | style : Style
Returns the style of this component. | CoreComponent | |
![]() | thumb : Sprite
The thumb display of the scrollbar. | CoreScrollbar | |
| thumbFillStyle : IFillStyle
Determinates the fill style object of the thumb. | SimpleScrollbar | ||
| thumbLineStyle : ILineStyle
Determinates the line style object of the thumb. | SimpleScrollbar | ||
![]() | thumbSize : Number
Determinates the size of the thumb. | CoreScrollbar | |
| topButton : FrameLabelButton
Indicates the top button used when the bar direction is Direction.VERTICAL. | SimpleScrollbar | ||
![]() | topLeftRadius : Number
The radius of the upper-left corner, in pixels. | Background | |
![]() | topRightRadius : Number
The radius of the upper-right corner, in pixels. | Background | |
![]() | useGradientBox : Boolean
Indicates if the IFillStyle of this display use gradient box matrix (only if the IFillStyle is a FillGradientStyle). | Background | |
![]() | w : Number
Determinates the virtual height value of this component. | Background | |
| Property | Defined By | ||
|---|---|---|---|
| container : Sprite
The internal container display of the bar and the thumb. | SimpleScrollbar | ||
![]() | _max : Number = 100
The max value of the progress. | CoreProgress | |
![]() | _min : Number = 0
The min value of the progress. | CoreProgress | |
![]() | _position : Number = 0
The position value of the bar. | CoreProgress | |
![]() | _scope : DisplayObjectContainer
The scope of the active display of this container component. | CoreComponent | |
| Method | Defined By | ||
|---|---|---|---|
SimpleScrollbar(direction:String = vertical, w:Number = 15, h:Number = 200)
Creates a new SimpleScrollbar instance. | SimpleScrollbar | ||
![]() | doLater():void
Launch an event with a delayed interval. | Background | |
![]() | dragging(e:Event = null):void
Invoked when the bar is dragging. | CoreScrollbar | |
draw(... arguments):void [override]
Draw the view of the component. | SimpleScrollbar | ||
![]() | getBuilderRenderer():Class
Returns the Builder constructor use to initialize this component. | CoreComponent | |
getStyleRenderer():Class [override]
Returns the Style Class of this instance. | SimpleScrollbar | ||
![]() | groupPolicyChanged():void
Invoked when the group property or the groupName property changed. | CoreComponent | |
![]() | hide():void
Hides the component. | CoreComponent | |
![]() | initBackgroundPen(graphic:* = null):IPen
Init the pen to draw the background of this display. | Background | |
![]() | initialize():void
Initialize the component. | CoreComponent | |
![]() | isLocked():Boolean
Returns true if the object is locked. | CoreSprite | |
![]() | isVisible():Boolean
Returns true if the component is visible. | CoreComponent | |
![]() | lock():void [override]
Locks the object. | CoreComponent | |
![]() | move(x:Number, y:Number):void
Moves the component. | CoreComponent | |
![]() | notifyChanged():void
Notify a change in this component. | CoreComponent | |
![]() | notifyDrag():void
Dispatchs an event when the user drag the bar. | CoreScrollbar | |
![]() | notifyEnabled():void
Notify an event when the enabled property is changed. | CoreComponent | |
![]() | notifyResized():void
Notify an event when you resize the component. | Background | |
![]() | notifyStartDrag():void
Dispatchs an event when the user start to drag the bar. | CoreScrollbar | |
![]() | notifyStopDrag():void
Dispatchs an event when the user stop to drag the bar. | CoreScrollbar | |
![]() | refresh(init:*):void
Refresh and initialize the display with a generic object and invoke the "update" method. | Background | |
![]() | registerView(scope:DisplayObjectContainer = null):void
Registers the view of this component. | CoreComponent | |
![]() | resetLock():void
Reset the lock security of the display. | CoreSprite | |
![]() | resize(e:Event = null):void
Resize and update the background. | Background | |
![]() | scope():DisplayObject
Returns the real scope reference of this component. | CoreComponent | |
![]() | setCornerRadius(n:Number):void
Defines all corner radius of the background (upper-left, upper-right, bottom-left and bottom-right). | Background | |
![]() | setPosition(value:Number, noEvent:Boolean = false, flag:Boolean = false):void
Sets the position of the progress bar. | CoreProgress | |
setScrollProperties(minimum:Number = 0, maximum:Number = 100, lineScrollSize:Number = 1, pageSize:Number = 0):void
Sets with this methods the pageSize, minimum, maximum and lineScrollSize values. | SimpleScrollbar | ||
![]() | setSize(w:Number, h:Number):void
Sets the virtual width (w) and height (h) values of the component. | Background | |
![]() | setStyle(... args):void
Sets the style property on the style declaration or object. | CoreComponent | |
![]() | show():void
Shows the component. | CoreComponent | |
![]() | startDragging(e:Event = null):void
Invoked when the user start to drag the bar. | CoreScrollbar | |
![]() | stopDragging(e:Event = null):void
Invoked when the user stop to drag the bar. | CoreScrollbar | |
![]() | unlock():void [override]
Unlocks the display. | CoreComponent | |
![]() | unregisterView():void
Unregisters the view of this component. | CoreComponent | |
![]() | update():void [override]
Updates the component. | CoreComponent | |
![]() | viewChanged():void [override]
Invoked when the view of the display is changed. | CoreProgress | |
![]() | viewDestroyed(e:Event = null):void
Invoked when the component is removed. | CoreComponent | |
viewEnabled():void [override]
Invoked when the enabled property of the component change. | SimpleScrollbar | ||
![]() | viewPositionChanged(flag:Boolean = false):void [override]
Invoked when the position value of the bar is changed. | CoreScrollbar | |
![]() | viewResize():void
Invoked when the component is resized. | Background | |
viewStyleChanged(e:Event = null):void [override]
Invoked when the component Style changed. | SimpleScrollbar | ||
| autoScroll | property |
public var autoScroll:Boolean = trueIndicates if the scrollbar scroll with a timer when the buttons are pressed.
| autoScrollDelay | property |
public var autoScrollDelay:Number = 500Indicates the delay is ms when the user click a button to run the auto scrolling (default 500).
| barFillStyle | property |
barFillStyle:IFillStyleDeterminates the fill style object of the bar.
public function get barFillStyle():IFillStyle public function set barFillStyle(value:IFillStyle):void| barLineStyle | property |
barLineStyle:ILineStyleDeterminates the line style object of the bar.
public function get barLineStyle():ILineStyle public function set barLineStyle(value:ILineStyle):void| bottomButton | property |
bottomButton:FrameLabelButtonIndicates the bottom button used when the bar direction is Direction.VERTICAL.
public function get bottomButton():FrameLabelButton public function set bottomButton(value:FrameLabelButton):void| container | property |
protected var container:SpriteThe internal container display of the bar and the thumb.
| cornerRadius | property |
cornerRadius:NumberThe global corner radius corner, in pixels (default 0).
public function get cornerRadius():Number public function set cornerRadius(value:Number):void| leftButton | property |
leftButton:FrameLabelButtonIndicates the left button used when the bar direction is Direction.HORIZONTAL.
public function get leftButton():FrameLabelButton public function set leftButton(value:FrameLabelButton):void| padding | property |
padding:EdgeMetricsThe padding between the arrow buttons and the bar.
public function get padding():EdgeMetrics public function set padding(value:EdgeMetrics):void| rightButton | property |
rightButton:FrameLabelButtonIndicates the right button used when the bar direction is Direction.HORIZONTAL.
public function get rightButton():FrameLabelButton public function set rightButton(value:FrameLabelButton):void| thumbFillStyle | property |
thumbFillStyle:IFillStyleDeterminates the fill style object of the thumb.
public function get thumbFillStyle():IFillStyle public function set thumbFillStyle(value:IFillStyle):void| thumbLineStyle | property |
thumbLineStyle:ILineStyleDeterminates the line style object of the thumb.
public function get thumbLineStyle():ILineStyle public function set thumbLineStyle(value:ILineStyle):void| topButton | property |
topButton:FrameLabelButtonIndicates the top button used when the bar direction is Direction.VERTICAL.
public function get topButton():FrameLabelButton public function set topButton(value:FrameLabelButton):void| SimpleScrollbar | () | Constructor |
public function SimpleScrollbar(direction:String = vertical, w:Number = 15, h:Number = 200)Creates a new SimpleScrollbar instance.
Parametersdirection:String (default = vertical) — The direction value of the bar ("horizontal" or "vertical", see graphics.Direction).
| |
w:Number (default = 15) — The prefered width of the button (default 120 pixels).
| |
h:Number (default = 200) — The prefered height of the button (default 20 pixels).
|
| draw | () | method |
override public function draw(... arguments):voidDraw the view of the component.
Parameters
... arguments |
| getStyleRenderer | () | method |
override public function getStyleRenderer():ClassReturns the Style Class of this instance.
ReturnsClass — the Style Class of this instance.
|
| setScrollProperties | () | method |
public function setScrollProperties(minimum:Number = 0, maximum:Number = 100, lineScrollSize:Number = 1, pageSize:Number = 0):voidSets with this methods the pageSize, minimum, maximum and lineScrollSize values.
Parameters
minimum:Number (default = 0) — Number which represetns the top of the scrolling range.
| |
maximum:Number (default = 100) — Number which represents the bottom of the scrolling range.
| |
lineScrollSize:Number (default = 1) — Number which represents the increment to move when the scroll track is pressed.
| |
pageSize:Number (default = 0) — Number which represents the size of one page.
|
| viewEnabled | () | method |
override public function viewEnabled():voidInvoked when the enabled property of the component change.
| viewStyleChanged | () | method |
override public function viewStyleChanged(e:Event = null):voidInvoked when the component Style changed.
Parameters
e:Event (default = null) |