| Package | lunas.components.buttons |
| Class | public class BackgroundButton |
| Inheritance | BackgroundButton CoreButton CoreComponent Background CoreSprite flash.display.Sprite |
| Subclasses | LabelButton, PictureButton, SwitchLabelButton |
Example :
package examples
{
import lunas.display.button.BackgroundButton;
import lunas.display.button.BackgroundButtonStyle;
import flash.display.Sprite;
import flash.display.StageScaleMode;
import flash.events.MouseEvent;
import flash.filters.DropShadowFilter;
public class ExampleBackgroundButton extends Sprite
{
public function ExampleBackgroundButton()
{
//////////
stage.scaleMode = StageScaleMode.NO_SCALE ;
//////////
var groupName:String = "background_button_group" ;
bt1 = new BackgroundButton() ;
bt1.x = 25 ;
bt1.y = 50 ;
bt1.groupName = groupName ;
bt1.toggle = true ;
addChild(bt1) ;
//////////
bt2 = new BackgroundButton() ;
bt2.x = 25 ;
bt2.y = 80 ;
bt2.groupName = groupName ;
bt2.toggle = true ;
addChild(bt2) ;
//////////
var init:Object =
{
themeFilters : [ new DropShadowFilter(4,45,0,0.7) ]
} ;
bt3 = new BackgroundButton() ;
bt3.x = 25 ;
bt3.y = 110 ;
bt3.groupName = groupName ;
bt3.toggle = true ;
bt3.style = new BackgroundButtonStyle( init ) ;
addChild(bt3) ;
//////////
bt1.addEventListener( MouseEvent.CLICK , click ) ;
bt2.addEventListener( MouseEvent.CLICK , click ) ;
bt3.addEventListener( MouseEvent.CLICK , click ) ;
////////// Test singleton style by default
bt1.setStyle( "topLeftRadius" , 4 ) ;
bt2.setStyle( "bottomLeftRadius" , 4 ) ;
// Note: the style is a singleton by default in all default components
}
public var bt1:BackgroundButton ;
public var bt2:BackgroundButton ;
public var bt3:BackgroundButton ;
public function click( e:MouseEvent ):void
{
trace( e ) ;
}
}
}
| Method | Defined By | ||
|---|---|---|---|
BackgroundButton(w:Number = 120, h:Number = 20)
Creates a new BackgroundButton instance. | BackgroundButton | ||
![]() | doLater():void
Launch an event with a delayed interval. | Background | |
![]() | draw(... arguments):void
Draw the display. | Background | |
getBuilderRenderer():Class [override]
Returns the Builder constructor use to initialize this component. | BackgroundButton | ||
getStyleRenderer():Class [override]
Returns the Style constructor use to initialize this component. | BackgroundButton | ||
![]() | groupPolicyChanged():void [override]
Invoked when the group property or the groupName property changed. | CoreButton | |
![]() | 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 | |
![]() | notifyEnabled():void
Notify an event when the enabled property is changed. | CoreComponent | |
![]() | notifyResized():void
Notify an event when you resize the component. | Background | |
![]() | refresh(init:*):void
Refresh and initialize the display with a generic object and invoke the "update" method. | Background | |
![]() | registerView(scope:DisplayObjectContainer = null):void [override]
Register the view in argument. | CoreButton | |
![]() | 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 | |
![]() | setSelected(b:Boolean, options:* = null):void
Sets a boolean value indicating whether the button is selected (true) or not (false). | CoreButton | |
![]() | 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 | |
![]() | unlock():void [override]
Unlocks the display. | CoreComponent | |
![]() | unregisterView():void [override]
Unregister the view of this button. | CoreButton | |
![]() | update():void [override]
Updates the component. | CoreComponent | |
![]() | viewChanged():void
This method is invoked after the draw() method in the update() method. | Background | |
![]() | viewDestroyed(e:Event = null):void
Invoked when the component is removed. | CoreComponent | |
![]() | viewEnabled():void [override]
Invoked when the enabled property of the component change. | CoreButton | |
![]() | viewLabelChanged():void
Invoked when the label property of the component change. | CoreButton | |
![]() | viewResize():void
Invoked when the component is resized. | Background | |
viewStyleChanged(e:Event = null):void [override]
Invoked when the component Style changed. | BackgroundButton | ||
| BackgroundButton | () | Constructor |
public function BackgroundButton(w:Number = 120, h:Number = 20)Creates a new BackgroundButton instance.
Example :
import lunas.components.buttons.BackgroundButton ;
var bt:LabelButton = new BackgroundButton() ;
bt.x = 25 ;
bt.y = 50 ;
bt.toggle = true ;
addChild(bt) ;
Parameters w:Number (default = 120) — The prefered width of the button (default 120 pixels).
| |
h:Number (default = 20) — The prefered height of the button (default 20 pixels).
|
| getBuilderRenderer | () | method |
override public function getBuilderRenderer():Class
Returns the Builder constructor use to initialize this component.
Class — the Builder constructor use to initialize this component.
|
| getStyleRenderer | () | method |
override public function getStyleRenderer():Class
Returns the Style constructor use to initialize this component.
Class — the Style constructor use to initialize this component.
|
| viewStyleChanged | () | method |
override public function viewStyleChanged(e:Event = null):voidInvoked when the component Style changed.
Parameters
e:Event (default = null) |