General purpose push button that supports both text and icon as well as repeat event dispatching
Composite Children |
|
Pseudo Classes |
|
Example (XML) |
<button text="Button"
styleNames="myCustomButton"
style="font-size: 30px"
onClick="trace('hello world')" /> |
Example (Haxe) |
var button = new Button();
button.text = "Button";
button.styleNames = "myCustomButton";
button.fontSize = 30;
button.onClick = function(e) {
trace("hello world");
} |
Properties |
easeInRepeater:Bool
Whether this button will ease in to specified repeatInterval
|
icon:Variant
The image resource to use as the buttons icon
|
remainPressed:Bool
Whether the buttons state should remain pressed even when the mouse has left its bounds
|
repeatInterval:Int
How often this button will dispatch multiple click events while the the mouse is pressed within it
|
repeater:Bool
Whether this button will dispatch multiple click events while the the mouse is pressed within it
|
selected:Bool
Whether this button is toggled or not (only relavant if toggle = true)
|
toggle:Bool
Whether this button should behave as a toggle button or not
|
Methods |
cloneComponent():Button |
Display tree related properties and methods |
hidden:Bool
Whether this component is hidden or not
|
numComponents:Int
Gets the number of child components under this component instance
|
rootComponent:Component
The top level component of this component instance
|
addComponent(child:Component):Component
Adds a child component to this component instance
|
addComponentAt(child:Component, index:Int):Component
Adds a child component to this component instance
|
findAncestor(criteria:String = null, type:Class<T> = null, searchType:String = "id"):Null<T>
Finds a specific parent in this components display tree and can optionally cast the result
|
findComponent(criteria:String = null, type:Class<T> = null, recursive:Bool = null, searchType:String = "id"):Null<T>
Finds a specific child in this components display tree (recusively if desired) and can optionally cast the result
|
getComponentAt(index:Int):Component
Gets a child component at a specified index
|
getComponentIndex(child:Component):Int
Gets the index of a child component
|
hide()
Hides this component and all its children
|
removeAllComponents(dispose:Bool = true)
Removes all child components from this component instance
|
removeComponent(child:Component, dispose:Bool = true, invalidate:Bool = true):Component
Removes the specified child component from this component instance
|
removeComponentAt(index:Int, dispose:Bool = true, invalidate:Bool = true):Component
Removes the child component from this component instance
|
show()
Shows this component and all its children
|
Event related properties and methods |
onAnimationEnd:AnimationEvent->Void |
onAnimationStart:AnimationEvent->Void |
onChange:UIEvent->Void |
onClick:MouseEvent->Void |
onRightClick:MouseEvent->Void |
Layout related properties and methods |
includeInLayout:Bool
Whether to use this component as part of its part layout
Note: invisible components are not included in parent layouts |
layout:Layout
The layout of this component
|
Script related properties and methods |
namedComponents:Array<Component>
Recursively generates list of all child components that have specified an id
|
script:String
A script string to associate with this component
Note: setting this to non-null will cause this component to create and maintain its own script interpreter during initialsation |
scriptAccess:Bool
Whether or not this component is allowed to be exposed to script interpreters (defaults to _true_)
|
addScriptEvent(event:String, script:String)
Registers a piece of hscript to be execute when a certain UIEvent is fired
|
executeScriptCall(expr:String, variablesMap = null)
Execute a script call
Note: this component will first attempt to use its own script interpreter if its avialable otherwise it will scan its parents until it finds one |
Style properties |
fontSize:Null<Float> |
iconPosition:String |
textAlign:String |
Style related properties and methods |
customStyle:Style
A custom style object that will appled to this component after any css rules have been matched and applied
|
styleNames:String
A string representation of the css classes associated with this component
|
styleString:String
An inline css string that will be parsed and applied as a custom style
|
addClass(name:String, invalidate:Bool = true, recursive:Bool = false)
Adds a css style name to this component
|
addClasses(names:Array<String>, invalidate:Bool = true, recursive:Bool = false)
Adds a css style names to this component
|
hasClass(name:String):Bool
Whether or not this component has a css class associated with it
|
removeClass(name:String, invalidate:Bool = true, recursive:Bool = false)
Removes a css style name from this component
|
removeClasses(names:Array<String>, invalidate:Bool = true, recursive:Bool = false)
Removes a css style names from this component
|
swapClass(classToAdd:String, classToRemove:String = null, invalidate:Bool = true, recursive:Bool = false)
Adds a css style name to this component
|