Package | com.ghostwire.ui.controls |
Class | public class uiButton |
Inheritance | uiButton ![]() ![]() |
Subclasses | uiImageButton, uiInteractiveItem, uiLabelButton, uiLink |
uiButton
class implements basic button behaviors.
If you need a button that contains an embedded image or text or both, you should use the
uiLabelButton
instead.
The uiButton
class is useful for instantiating basic
fully skinned buttons without child elements, usually not intended to be resized. As an example, you
can create a barebones standalone checkbox button without an accompanying label with the
following code:
var choiceButton:uiButton = new uiButton(); choiceButton.toggle = true; choiceButton.skin = "CheckBox";
"skin" Property
The default value is "Button"
and the asset(s) used are:
Button.png
~ This class is available in Aspire UI Components Lite Edition ~
Property | Defined by | ||
---|---|---|---|
![]() | alignX : Number
Indicates how the component would like to be aligned horizontally within its allocated space.
| uiComponent | |
![]() | alignY : Number
Indicates how the component would like to be aligned vertically within its allocated space.
| uiComponent | |
![]() | background : Object
Indicates the style of the background for this component.
| uiComponent | |
![]() | container : uiComponent
Indicates the
uiComponent instance that contains this instance. | uiComponent | |
data : Object
Indicates the data to be associated with this button.
| uiButton | ||
![]() | depth : int
Indicates how deep the component is in the containment hierarchy.
| uiComponent | |
![]() | desiredAllocationHeight : int
Indicates the vertical space this component would like to be allocated.
| uiComponent | |
![]() | desiredAllocationWidth : int
Indicates the horizontal space this component would like to be allocated.
| uiComponent | |
displaceX : int
Indicates the amount of pixels to move any embedded child object horizontally to the right when the
button is pressed down.
| uiButton | ||
displaceY : int
Indicates the amount of pixels to move any embedded child object vertically downwards when the
button is pressed down.
| uiButton | ||
![]() | enabled : Boolean
Indicates whether the component is enabled for user interaction.
| uiComponent | |
![]() | fillX : Boolean
Indicates whether or not the component should automatically expand or shrink to fill its allocated
horizontal space.
| uiComponent | |
![]() | fillY : Boolean
Indicates whether or not the component should automatically expand or shrink to fill its allocated
vertical space.
| uiComponent | |
![]() | focusPadding : Object
Indicates the thickness of the interior space from the edge of the component to the focus
rectangle.
| uiComponent | |
![]() | focusRect : Object
Indicates the class to use when rendering the rectangle around the component to indicate that it
is in focus.
| uiComponent | |
group : uiButtonGroup
Indicates the
uiButtonGroup this button is assigned to. | uiButton | ||
![]() | height : Number
Indicates the current
height of the component. | uiComponent | |
![]() | margin : Object
Indicates the thickness of the space surrounding the component.
| uiComponent | |
![]() | maxHeight : int
Indicates the upper limit for
height . | uiComponent | |
![]() | maxWidth : int
Indicates the upper limit for
width . | uiComponent | |
![]() | minHeight : int
Indicates the lower limit for
height . | uiComponent | |
![]() | minWidth : int
Indicates the lower limit for
width . | uiComponent | |
![]() | padding : Object
Indicates the thickness of the interior space from the edge of the component to the content area,
which is where child components, if any, are contained.
| uiComponent | |
selected : Boolean
Indicates whether the button is selected; applicable only if the
toggle property is
set to true . | uiButton | ||
![]() | skin : String
Indicates the name of the skin to use for this component instance.
| uiComponent | |
![]() | stretch : Boolean
Indicates whether surplus space available in the parent container should be allocated to this
component.
| uiComponent | |
![]() | textStyle : String
Indicates the style to use for
uiText instances contained in this component. | uiComponent | |
toggle : Boolean
Indicates whether the button should toggle its
selected property value between
true and false when it is clicked. | uiButton | ||
![]() | toolTip : Object
Indicates the content (text) of the tooltip that should be shown when the mouse hovers
over this control.
| uiComponent | |
![]() | uiskin : uiBitmapImage
Returns the
uiBitmapImage rendered as the skin - for advanced users only. | uiComponent | |
![]() | visible : Boolean
Indicates whether or not the component is visible within its container.
| uiComponent | |
![]() | width : Number
Indicates the current
width of the component. | uiComponent |
Method | Defined by | ||
---|---|---|---|
uiButton()
Constructor - creates a new
uiButton instance. | uiButton | ||
activate(noEvent:Boolean = false):void
Activates and gives focus to the button as if the button has been clicked on (a
MouseEvent.CLICK event will be dispatched). | uiButton | ||
![]() |
invalidate(type:String):void
Invalidates this component's "size", "display", "layout" or "textstyle".
| uiComponent | |
![]() |
move(x:Number, y:Number, noEvent:Boolean = false):void
Moves the component to the specified position, disregarding its allocation.
| uiComponent | |
![]() |
removeAllChildren(all:Boolean = false):void
Removes all children from this component.
| uiComponent | |
![]() |
setFocus(flag:Boolean = true):void
Gives this component instance the focus; the component must be on the display list and has its
tabEnabled property set to true , otherwise this method will fail
silently. | uiComponent | |
![]() |
setSize(width:Number, height:Number, noEvent:Boolean = false):void
Sets this component's size to the specified
width and height . | uiComponent | |
![]() |
setVisible(value:Boolean, noEvent:Boolean = false):void
Sets the visibility of this component instance, dispatching a "show" or "hide" event accordingly.
| uiComponent | |
![]() |
validateNow():void
Validates and render the component instance, and any component instances with
depth higher than itself in the validation queue, immediately. | uiComponent |
Event | Summary | Defined by | ||
---|---|---|---|---|
Dispatched when the selected property changes. | uiButton | |||
Dispatched when the button is activated, either by user clicking on it or pressing the
SPACE key while the button is in focus. | uiButton | |||
![]() |
Dispatched when the component's visible property is changed from true to
false via calling the setVisible() method. | uiComponent | ||
![]() |
Dispatched when the component's position within its parent container has changed via calling the
move() method. | uiComponent | ||
![]() |
Dispatched when the component's size has changed via calling the setSize() method. | uiComponent | ||
![]() |
Dispatched when the component's visible property is changed from false to
true via calling the setVisible() method. | uiComponent |
data | property |
data:Object
[read-write]Indicates the data to be associated with this button.
The default value is null
.
public function get data():Object
public function set data(value:Object):void
displaceX | property |
displaceX:int
[read-write]Indicates the amount of pixels to move any embedded child object horizontally to the right when the button is pressed down. A negative number means that the child object will be moved to the left.
This property is applicable only for subclasses that implements embedding of a child object in the
button, such as the uiLabelButton
or uiInteractiveItem
classes.
The default value is 0
.
public function get displaceX():int
public function set displaceX(value:int):void
displaceY | property |
displaceY:int
[read-write]Indicates the amount of pixels to move any embedded child object vertically downwards when the button is pressed down. A negative number means that the child object will be moved upwards.
This property is applicable only for subclasses that implements embedding of a child object in the
button, such as the uiLabelButton
or uiInteractiveItem
classes.
The default value is 0
.
public function get displaceY():int
public function set displaceY(value:int):void
group | property |
group:uiButtonGroup
[read-write]
Indicates the uiButtonGroup
this button is assigned to.
When you create a set of buttons with their group
property set to the same
uiButtonGroup
object, only one of those buttons can be selected at any one time. When you
assign a uiButton
instance to a uiButtonGroup
its toggle
property
will be set to true
automatically.
Only the currently selected button in a group will participate in the tab order. When the selected button has focus, the user may use the UP, DOWN, LEFT and RIGHT keys to select the other buttons in the group. In order for this behavior to function properly, you must place all the buttons in the same group in the same container. If none of the buttons has been selected, all the buttons will participate in the tab order normally (until one button has been selected).
The default value is null
.
public function get group():uiButtonGroup
public function set group(value:uiButtonGroup):void
See also
selected | property |
selected:Boolean
[read-write]
Indicates whether the button is selected; applicable only if the toggle
property is
set to true
.
If the button is intended to be a member of a uiButtonGroup
, you should not use this
property. Instead, set the uiButtonGroup.selectedButton
property to the button in the
group to be selected.
Changing the selected
property dispatches a change
event.
public function get selected():Boolean
public function set selected(value:Boolean):void
toggle | property |
toggle:Boolean
[read-write]
Indicates whether the button should toggle its selected
property value between
true
and false
when it is clicked.
public function get toggle():Boolean
public function set toggle(value:Boolean):void
uiButton | () | constructor |
public function uiButton()
Constructor - creates a new uiButton
instance.
activate | () | method |
public function activate(noEvent:Boolean = false):void
Activates and gives focus to the button as if the button has been clicked on (a
MouseEvent.CLICK
event will be dispatched). The MouseEvent
object
dispatched by this method will have its localX
, localY
,
stageX
and stageY
properties set to NaN
.
noEvent:Boolean (default = false ) — A Boolean value - call the method with this parameter set to true if you do not want the MouseEvent.CLICK event to be dispatched.
|
change | event |
click | event |
flash.events.MouseEvent
Dispatched when the button is activated, either by user clicking on it or pressing the
SPACE
key while the button is in focus.