Packagelunas.components.bars
Classpublic class SimpleProgressbar
InheritanceSimpleProgressbar Inheritance CoreProgressbar Inheritance CoreProgress Inheritance CoreComponent Inheritance Background Inheritance CoreSprite Inheritance flash.display.Sprite

The SimpleProgressbar component.

Example :

     import flash.display.StageScaleMode ;
     
     import graphics.Align ;
     import graphics.Direction ;
     import graphics.FillStyle ;
     import graphics.LineStyle ;
     import graphics.geom.EdgeMetrics ;
     
     import lunas.components.bars.SimpleProgressbar ;
     import lunas.events.ComponentEvent ;
     
     stage.scaleMode = StageScaleMode.NO_SCALE ;
     
     var change:Function = function( e:ComponentEvent ):void
     {
         trace( e.type + " : " + bar.position ) ;
     }
     
     var bar:SimpleProgressbar = new SimpleProgressbar() ;
     bar.addEventListener( ComponentEvent.CHANGE , change ) ;
     bar.x = 50 ;
     bar.y = 50 ;
     bar.position = 50 ;
     
     addChild(bar) ;
     
     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.SPACE :
             {
                 bar.lock() ;
                 bar.align               = Align.CENTER ; // Align.LEFT or Align.RIGHT or Align.CENTER
                 bar.direction           = Direction.HORIZONTAL ;
                 bar.backgroundFillStyle = new FillStyle( 0xB5C7CA , 1 ) ;
                 bar.backgroundLineStyle = new LineStyle( 2 , 0xFFFFFF , 1 ) ;
                 bar.barFillStyle        = new FillStyle( 0x921085 , 1 ) ;
                 bar.barLineStyle        = new LineStyle( 1 , 0x6A9195, 1 ) ;
                 bar.border              = new EdgeMetrics(2, 2, 2, 2) ;
                 bar.unlock() ;
                 bar.setSize( 200, 8 ) ;
                 break ;
             }
             case Keyboard.UP :
             {
                 bar.minimum = 20  ;
                 bar.maximum = 200 ;
                 break ;
             }
             default :
             {
                 bar.direction = ( bar.direction == Direction.VERTICAL ) ? Direction.HORIZONTAL : Direction.VERTICAL ;
                 if ( bar.direction == Direction.VERTICAL )
                 {
                     bar.setSize( 8, 200 ) ;
                 }
                 else
                 {
                     bar.setSize( 200, 8 ) ;
                 }
             }
         }
     }
     
     stage.addEventListener( KeyboardEvent.KEY_DOWN , keyDown ) ;
     
     trace("Press Keyboard.LEFT or Keyboard.RIGHT or Keyboard.SPACE or other keyboard touch to test this example.") ;
     



Public Properties
 PropertyDefined By
 Inheritedalign : uint
The alignement of the background.
Background
 InheritedautoResetPosition : Boolean
This flag indicates of the position is auto reset.
CoreProgress
 InheritedautoSize : Boolean
Indicates if the background is resizing when the stage resize event is invoked.
Background
  background : Shape
The background reference of this component.
SimpleProgressbar
  backgroundFillStyle : IFillStyle
Determinates the fill style object of the background.
SimpleProgressbar
  backgroundLineStyle : ILineStyle
Determinates the line style object of the background.
SimpleProgressbar
  bar : Shape
The thumb reference of this bar.
SimpleProgressbar
  barFillStyle : IFillStyle
Determinates the fill style object of the bar.
SimpleProgressbar
  barLineStyle : ILineStyle
Determinates the line style object of the bar.
SimpleProgressbar
 Inheritedborder : EdgeMetrics
Indicates the thickness, in pixels, of the four edge regions around a visual component.
CoreComponent
 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
 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
 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
 Inheritedline : ILineStyle
Determinates the ILineStyle reference of this display.
Background
 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
 Inheritedposition : Number
Indicates the position of the progress bar.
CoreProgress
 Inheritedstyle : Style
Returns the style of this component.
CoreComponent
 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
 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
  
SimpleProgressbar(direction:String = null, w:Number = 150, h:Number = 6)
Creates a new SimpleProgressbar instance.
SimpleProgressbar
 Inherited
doLater():void
Launch an event with a delayed interval.
Background
  
draw(... arguments):void
[override] Draws the view of the component.
SimpleProgressbar
 Inherited
Returns the Builder constructor use to initialize this component.
CoreComponent
 Inherited
Returns the Style constructor use to initialize this component.
CoreComponent
 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
Notify an event when the enabled property is changed.
CoreComponent
 Inherited
Notify an event when you resize the component.
Background
 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
 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
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
 Inherited
Invoked when the enabled property of the component change.
Background
  
viewPositionChanged(flag:Boolean = false):void
[override] Invoked when the position of the bar is changed.
SimpleProgressbar
 Inherited
viewResize():void
Invoked when the component is resized.
Background
 Inherited
viewStyleChanged(e:Event = null):void
Invoked when the component Style changed.
CoreComponent
Protected Methods
 MethodDefined By
 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
backgroundproperty
public var background:Shape

The background reference of this component.

backgroundFillStyleproperty 
backgroundFillStyle:IFillStyle

Determinates the fill style object of the background.


Implementation
    public function get backgroundFillStyle():IFillStyle
    public function set backgroundFillStyle(value:IFillStyle):void
backgroundLineStyleproperty 
backgroundLineStyle:ILineStyle

Determinates the line style object of the background.


Implementation
    public function get backgroundLineStyle():ILineStyle
    public function set backgroundLineStyle(value:ILineStyle):void
barproperty 
public var bar:Shape

The thumb reference of this bar.

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
Constructor Detail
SimpleProgressbar()Constructor
public function SimpleProgressbar(direction:String = null, w:Number = 150, h:Number = 6)

Creates a new SimpleProgressbar instance.

Parameters
direction:String (default = null) — The direction value of the bar ("horizontal" or "vertical", see graphics.Direction).
 
w:Number (default = 150) — The prefered width of the button (default 120 pixels).
 
h:Number (default = 6) — The prefered height of the button (default 20 pixels).
Method Detail
draw()method
override public function draw(... arguments):void

Draws the view of the component.

Parameters

... arguments

viewPositionChanged()method 
override public function viewPositionChanged(flag:Boolean = false):void

Invoked when the position of the bar is changed.

Parameters

flag:Boolean (default = false) — (optional) An optional boolean. By default this flag is passed-in the setPosition method.