Packagelunas.components.bars
Classpublic class SimpleScrollbar
InheritanceSimpleScrollbar Inheritance CoreScrollbar Inheritance CoreProgressbar Inheritance CoreProgress Inheritance CoreComponent Inheritance Background Inheritance CoreSprite Inheritance flash.display.Sprite

The SimpleScrollbar component.

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 ) ;
     



Public Properties
 PropertyDefined By
 Inheritedalign : uint
The alignement of the background.
Background
 InheritedautoResetPosition : 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
 InheritedautoSize : Boolean
Indicates if the background is resizing when the stage resize event is invoked.
Background
 Inheritedbar : 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
 Inheritedborder : 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
 InheritedbottomLeftRadius : Number
The radius of the bottom-left corner, in pixels.
Background
 InheritedbottomRightRadius : Number
The radius of the bottom-right corner, in pixels.
Background
 Inheritedbubbles : Boolean = true
Indicates if the events use bubbling when are dispatched.
CoreComponent
 Inheritedbuilder : Builder
Indicates the Builder reference of this instance.
CoreComponent
 InheritedcomponentInspectorSetting : 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
 Inheriteddirection : String
Indicates the direction value of the background when the display is in this "full" mode (default value is null).
Background
 Inheritedenabled : Boolean
Indicates the enabled state of the component.
CoreComponent
 Inheritedfill : IFillStyle
Determinates the IFillStyle reference of this display.
Background
 InheritedgradientMatrix : Matrix
The matrix value to draw the gradient fill.
Background
 InheritedgradientRotation : Number = 0
The rotation value to draw the gradient fill.
Background
 InheritedgradientTranslation : Point
The translation vector to draw the gradient fill.
Background
 Inheritedgroup : Boolean
Indicates with a boolean if this object is grouped.
CoreComponent
 InheritedgroupName : String
Indicates the name of the group of this object.
CoreComponent
 Inheritedh : Number
Determinates the virtual height value of this component.
Background
 Inheritedinvert : Boolean
Indicates if the layout direction of the thumb is invert.
CoreScrollbar
 InheritedisDragging : Boolean
[read-only] Indicates if the bar is dragging.
CoreScrollbar
 InheritedisFull : Boolean
Indicates if the background use full size (use Stage.stageWidth and Stage.stageHeight to resize the background).
Background
 Inheritedlayout : Layout
Determinates the layout of this container.
CoreComponent
  leftButton : FrameLabelButton
Indicates the left button used when the bar direction is Direction.HORIZONTAL.
SimpleScrollbar
 Inheritedline : ILineStyle
Determinates the ILineStyle reference of this display.
Background
 InheritedlineScrollSize : Number
Determines how much the scrollbar's value will change when one of the arrow buttons is clicked.
CoreScrollbar
 Inheritedlogger : Logger
Determinates the internal ILogger reference of this Logable object.
CoreSprite
 InheritedmaxHeight : Number
This property defined the maximum height of this display.
Background
 Inheritedmaximum : Number
The maximum value of this scrollbar.
CoreProgress
 InheritedmaxWidth : Number
Defines the maximum width of this display.
Background
 InheritedminHeight : Number
This property defined the mimimun height of this display (This value is >= 0).
Background
 Inheritedminimum : Number
The minimum value of this scrollbar.
CoreProgress
 InheritedminWidth : 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
 InheritedpageSize : Number
Determines the amount the value will change if the user clicks above or below the thumb.
CoreScrollbar
 Inheritedposition : Number
Indicates the position of the progress bar.
CoreProgress
  rightButton : FrameLabelButton
Indicates the right button used when the bar direction is Direction.HORIZONTAL.
SimpleScrollbar
 Inheritedstyle : Style
Returns the style of this component.
CoreComponent
 Inheritedthumb : 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
 InheritedthumbSize : Number
Determinates the size of the thumb.
CoreScrollbar
  topButton : FrameLabelButton
Indicates the top button used when the bar direction is Direction.VERTICAL.
SimpleScrollbar
 InheritedtopLeftRadius : Number
The radius of the upper-left corner, in pixels.
Background
 InheritedtopRightRadius : Number
The radius of the upper-right corner, in pixels.
Background
 InheriteduseGradientBox : Boolean
Indicates if the IFillStyle of this display use gradient box matrix (only if the IFillStyle is a FillGradientStyle).
Background
 Inheritedw : Number
Determinates the virtual height value of this component.
Background
Protected Properties
 PropertyDefined By
  container : Sprite
The internal container display of the bar and the thumb.
SimpleScrollbar
 Inherited_max : Number = 100
The max value of the progress.
CoreProgress
 Inherited_min : Number = 0
The min value of the progress.
CoreProgress
 Inherited_position : Number = 0
The position value of the bar.
CoreProgress
 Inherited_scope : DisplayObjectContainer
The scope of the active display of this container component.
CoreComponent
Public Methods
 MethodDefined By
  
SimpleScrollbar(direction:String = vertical, w:Number = 15, h:Number = 200)
Creates a new SimpleScrollbar instance.
SimpleScrollbar
 Inherited
doLater():void
Launch an event with a delayed interval.
Background
 Inherited
dragging(e:Event = null):void
Invoked when the bar is dragging.
CoreScrollbar
  
draw(... arguments):void
[override] Draw the view of the component.
SimpleScrollbar
 Inherited
Returns the Builder constructor use to initialize this component.
CoreComponent
  
[override] Returns the Style Class of this instance.
SimpleScrollbar
 Inherited
Invoked when the group property or the groupName property changed.
CoreComponent
 Inherited
hide():void
Hides the component.
CoreComponent
 Inherited
initBackgroundPen(graphic:* = null):IPen
Init the pen to draw the background of this display.
Background
 Inherited
initialize():void
Initialize the component.
CoreComponent
 Inherited
isLocked():Boolean
Returns true if the object is locked.
CoreSprite
 Inherited
isVisible():Boolean
Returns true if the component is visible.
CoreComponent
 Inherited
lock():void
[override] Locks the object.
CoreComponent
 Inherited
move(x:Number, y:Number):void
Moves the component.
CoreComponent
 Inherited
Notify a change in this component.
CoreComponent
 Inherited
notifyDrag():void
Dispatchs an event when the user drag the bar.
CoreScrollbar
 Inherited
Notify an event when the enabled property is changed.
CoreComponent
 Inherited
Notify an event when you resize the component.
Background
 Inherited
Dispatchs an event when the user start to drag the bar.
CoreScrollbar
 Inherited
Dispatchs an event when the user stop to drag the bar.
CoreScrollbar
 Inherited
refresh(init:*):void
Refresh and initialize the display with a generic object and invoke the "update" method.
Background
 Inherited
registerView(scope:DisplayObjectContainer = null):void
Registers the view of this component.
CoreComponent
 Inherited
resetLock():void
Reset the lock security of the display.
CoreSprite
 Inherited
resize(e:Event = null):void
Resize and update the background.
Background
 Inherited
scope():DisplayObject
Returns the real scope reference of this component.
CoreComponent
 Inherited
setCornerRadius(n:Number):void
Defines all corner radius of the background (upper-left, upper-right, bottom-left and bottom-right).
Background
 Inherited
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
 Inherited
setSize(w:Number, h:Number):void
Sets the virtual width (w) and height (h) values of the component.
Background
 Inherited
setStyle(... args):void
Sets the style property on the style declaration or object.
CoreComponent
 Inherited
show():void
Shows the component.
CoreComponent
 Inherited
startDragging(e:Event = null):void
Invoked when the user start to drag the bar.
CoreScrollbar
 Inherited
stopDragging(e:Event = null):void
Invoked when the user stop to drag the bar.
CoreScrollbar
 Inherited
unlock():void
[override] Unlocks the display.
CoreComponent
 Inherited
Unregisters the view of this component.
CoreComponent
 Inherited
update():void
[override] Updates the component.
CoreComponent
 Inherited
[override] Invoked when the view of the display is changed.
CoreProgress
 Inherited
viewDestroyed(e:Event = null):void
Invoked when the component is removed.
CoreComponent
  
[override] Invoked when the enabled property of the component change.
SimpleScrollbar
 Inherited
viewPositionChanged(flag:Boolean = false):void
[override] Invoked when the position value of the bar is changed.
CoreScrollbar
 Inherited
viewResize():void
Invoked when the component is resized.
Background
  
viewStyleChanged(e:Event = null):void
[override] Invoked when the component Style changed.
SimpleScrollbar
Protected Methods
 MethodDefined By
 Inherited
_fireButtonEvent(type:String):void
Dispatchs a ButtonEvent with the specified type.
CoreScrollbar
 Inherited
addedToStage(e:Event = null):void
Invoked when the display is added to the stage.
CoreSprite
 Inherited
addedToStageResize(e:Event = null):void
Invoked when the display is removed from the stage to enable the autoSize mode.
Background
 Inherited
fireComponentEvent(type:String):void
Dispatchs a ComponentEvent with the specified type.
CoreComponent
 Inherited
removedFromStage(e:Event = null):void
Invoked when the display is removed from the stage.
CoreSprite
 Inherited
removedFromStageResize(e:Event = null):void
Invoked when the display is removed from the stage to disable the autoSize mode.
Background
 Inherited
renderLayout(layout:Layout = null):void
Receives a message when the layout emit when is rendered.
CoreComponent
 Inherited
updateLayout(layout:Layout = null):void
Receives a message when the layout emit when is updated.
CoreComponent
Property Detail
autoScrollproperty
public var autoScroll:Boolean = true

Indicates if the scrollbar scroll with a timer when the buttons are pressed.

autoScrollDelayproperty 
public var autoScrollDelay:Number = 500

Indicates the delay is ms when the user click a button to run the auto scrolling (default 500).

barFillStyleproperty 
barFillStyle:IFillStyle

Determinates the fill style object of the bar.


Implementation
    public function get barFillStyle():IFillStyle
    public function set barFillStyle(value:IFillStyle):void
barLineStyleproperty 
barLineStyle:ILineStyle

Determinates the line style object of the bar.


Implementation
    public function get barLineStyle():ILineStyle
    public function set barLineStyle(value:ILineStyle):void
bottomButtonproperty 
bottomButton:FrameLabelButton

Indicates the bottom button used when the bar direction is Direction.VERTICAL.


Implementation
    public function get bottomButton():FrameLabelButton
    public function set bottomButton(value:FrameLabelButton):void
containerproperty 
protected var container:Sprite

The internal container display of the bar and the thumb.

cornerRadiusproperty 
cornerRadius:Number

The global corner radius corner, in pixels (default 0).


Implementation
    public function get cornerRadius():Number
    public function set cornerRadius(value:Number):void
leftButtonproperty 
leftButton:FrameLabelButton

Indicates the left button used when the bar direction is Direction.HORIZONTAL.


Implementation
    public function get leftButton():FrameLabelButton
    public function set leftButton(value:FrameLabelButton):void
paddingproperty 
padding:EdgeMetrics

The padding between the arrow buttons and the bar.


Implementation
    public function get padding():EdgeMetrics
    public function set padding(value:EdgeMetrics):void
rightButtonproperty 
rightButton:FrameLabelButton

Indicates the right button used when the bar direction is Direction.HORIZONTAL.


Implementation
    public function get rightButton():FrameLabelButton
    public function set rightButton(value:FrameLabelButton):void
thumbFillStyleproperty 
thumbFillStyle:IFillStyle

Determinates the fill style object of the thumb.


Implementation
    public function get thumbFillStyle():IFillStyle
    public function set thumbFillStyle(value:IFillStyle):void
thumbLineStyleproperty 
thumbLineStyle:ILineStyle

Determinates the line style object of the thumb.


Implementation
    public function get thumbLineStyle():ILineStyle
    public function set thumbLineStyle(value:ILineStyle):void
topButtonproperty 
topButton:FrameLabelButton

Indicates the top button used when the bar direction is Direction.VERTICAL.


Implementation
    public function get topButton():FrameLabelButton
    public function set topButton(value:FrameLabelButton):void
Constructor Detail
SimpleScrollbar()Constructor
public function SimpleScrollbar(direction:String = vertical, w:Number = 15, h:Number = 200)

Creates a new SimpleScrollbar instance.

Parameters
direction: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).
Method Detail
draw()method
override public function draw(... arguments):void

Draw the view of the component.

Parameters

... arguments

getStyleRenderer()method 
override public function getStyleRenderer():Class

Returns the Style Class of this instance.

Returns
Class — the Style Class of this instance.
setScrollProperties()method 
public function 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.

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():void

Invoked when the enabled property of the component change.

viewStyleChanged()method 
override public function viewStyleChanged(e:Event = null):void

Invoked when the component Style changed.

Parameters

e:Event (default = null)