| Package | lunas.components.buttons |
| Class | public class FrameLabelButton |
| Inheritance | FrameLabelButton CoreButton CoreComponent Background CoreSprite flash.display.Sprite |
| Subclasses | BitmapFilterButton, LightFrameLabelButton |
The stop() method is call in the first frame of the component when the constructor is launched.
This class looks like SimpleButton class but you can use the registerType() and the unregisterType() method to add or remove a ButtonEvent type (DISABLED, OVER, DOWN...) corresponding with a frame label in the MovieClip view of the button.
Example :
import lunas.components.buttons.FrameLabelButton ;
import lunas.events.ButtonEvent ;
var bt:FrameLabelButton = new FrameLabelButton() ;
bt.x = 50 ;
bt.y = 50 ;
// only if toggle is true and selected is true
bt.registerType( ButtonEvent.OVER_SELECTED ) ;
bt.registerType( ButtonEvent.OUT_SELECTED ) ;
addChild(bt) ;
try
{
// The QuestionButton is the class of a MovieClip in the library of the swf who extends MovieClip
bt.states = new QuestionButton() ;
}
catch(e:Error )
{
trace(e) ;
}
// test the toggle
var keyDown:Function = function( e:KeyboardEvent ):void
{
var code:uint = e.keyCode ;
switch( code )
{
case Keyboard.SPACE :
{
bt.enabled = !bt.enabled ;
break ;
}
default :
{
bt.toggle = !bt.toggle ;
}
}
}
stage.addEventListener( KeyboardEvent.KEY_DOWN , keyDown ) ;
// debug
var debug:Function = function( e:Event ):void
{
trace( "toggle:" + bt.toggle + " selected:" + bt.selected + " type:" + e.type + " enabled:" + bt.enabled ) ;
}
bt.addEventListener( ButtonEvent.CLICK , debug ) ;
bt.addEventListener( ButtonEvent.DISABLED , debug ) ;
bt.addEventListener( ButtonEvent.DOWN , debug ) ;
bt.addEventListener( ButtonEvent.OUT , debug ) ;
bt.addEventListener( ButtonEvent.OUT_SELECTED , debug ) ;
bt.addEventListener( ButtonEvent.OVER , debug ) ;
bt.addEventListener( ButtonEvent.OVER_SELECTED , debug ) ;
bt.addEventListener( ButtonEvent.SELECT , debug ) ;
bt.addEventListener( ButtonEvent.UNSELECT , debug ) ;
bt.addEventListener( ButtonEvent.UP , debug ) ;
| Property | Defined By | ||
|---|---|---|---|
![]() | align : uint
The alignement of the background. | Background | |
![]() | autoSize : Boolean
Indicates if the background is resizing when the stage resize event is invoked. | Background | |
![]() | border : EdgeMetrics
Indicates the thickness, in pixels, of the four edge regions around a visual component. | CoreComponent | |
![]() | 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 | |
![]() | buttonMode : Boolean [override] [write-only]
Specifies whether this object receives mouse messages. | CoreButton | |
![]() | componentInspectorSetting : Boolean
Initialize when the Flash component settings are initialized (only in Flash with a compiled component). | CoreComponent | |
![]() | data : *
Indicates the data value object of the component. | CoreButton | |
![]() | 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 | |
![]() | index : Number
A number value to indicated the index of this IButton. | CoreButton | |
| initStatesEnabled : Boolean = true
This flag indicates if a new state register in the button is initialize. | FrameLabelButton | ||
![]() | isFull : Boolean
Indicates if the background use full size (use Stage.stageWidth and Stage.stageHeight to resize the background). | Background | |
![]() | isReleaseOutside : Boolean = true
Indicates if the button notify a releaseOutside event. | CoreButton | |
![]() | label : String
Returns the text label for a button instance. | CoreButton | |
![]() | layout : Layout
Determinates the layout of this container. | CoreComponent | |
![]() | line : ILineStyle
Determinates the ILineStyle reference of this display. | Background | |
![]() | logger : Logger
Determinates the internal ILogger reference of this Logable object. | CoreSprite | |
![]() | maxHeight : Number
This property defined the maximum height of this display. | Background | |
![]() | 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 | |
![]() | minWidth : Number
This property defined the mimimun width of this display (This value is >= 0). | Background | |
![]() | mouseEnabled : Boolean [override]
Specifies whether this object receives mouse messages. | CoreButton | |
![]() | selected : Boolean
A flag that indicates whether this control is selected. | CoreButton | |
| states : MovieClip
Indicates the MovieClip reference with the state frames of this button. | FrameLabelButton | ||
![]() | style : Style
Returns the style of this component. | CoreComponent | |
![]() | toggle : Boolean
Indicates a boolean value indicating whether the button behaves as a toggle switch (true) or not (false). | CoreButton | |
![]() | 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 | |
![]() | useHandCursor : Boolean [override]
A Boolean value that, when set to true, indicates whether Flash Player displays the hand cursor when the mouse rolls over a button. | CoreButton | |
![]() | w : Number
Determinates the virtual height value of this component. | Background | |
| Method | Defined By | ||
|---|---|---|---|
FrameLabelButton(states:MovieClip = null)
Creates a new FrameLabelButton instance. | FrameLabelButton | ||
containsType(type:String):Boolean
Returns true if the specified type is register in the object. | FrameLabelButton | ||
![]() | doLater():void
Launch an event with a delayed interval. | Background | |
![]() | draw(... arguments):void
Draw the display. | Background | |
getBuilderRenderer():Class [override]
Returns the constructor function of the IBuilder of this instance. | FrameLabelButton | ||
![]() | getStyleRenderer():Class
Returns the Style constructor use to initialize this component. | CoreComponent | |
![]() | 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 | |
registerType(type:String, callback:Function = null):void
Registers the ButtonEvent type passed in argument. | FrameLabelButton | ||
![]() | 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 | |
unregisterType(type:String):void
Unregisters the ButtonEvent type passed in argument. | FrameLabelButton | ||
![]() | 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
Invoked when the component Style changed. | CoreComponent | |
| initStatesEnabled | property |
public var initStatesEnabled:Boolean = trueThis flag indicates if a new state register in the button is initialize.
| states | property |
states:MovieClipIndicates the MovieClip reference with the state frames of this button.
public function get states():MovieClip public function set states(value:MovieClip):void| FrameLabelButton | () | Constructor |
public function FrameLabelButton(states:MovieClip = null)Creates a new FrameLabelButton instance.
Parametersstates:MovieClip (default = null) — the MovieClip reference with the state frames of this button.
|
| containsType | () | method |
public function containsType(type:String):Boolean
Returns true if the specified type is register in the object.
Parameters
type:String |
Boolean — true if the specified type is register in the object.
|
| getBuilderRenderer | () | method |
override public function getBuilderRenderer():Class
Returns the constructor function of the IBuilder of this instance.
Class — the constructor function of the IBuilder of this instance.
|
| registerType | () | method |
public function registerType(type:String, callback:Function = null):voidRegisters the ButtonEvent type passed in argument.
Parameters
type:String — The type of the frame event to register (choose your event in the ButtonEvent static enumeration).
| |
callback:Function (default = null) — The optional method of the button to launch
|
| unregisterType | () | method |
public function unregisterType(type:String):voidUnregisters the ButtonEvent type passed in argument.
Parameters
type:String |