Button


Inheritance Button View Module hilo/view/Button Requires hilo/core/Hilo, hilo/core/Class, hilo/view/View, hilo/view/Drawable, hilo/util/util Source Button.js
Button class is a simple button class, contains four kinds of state: 'up', 'over', 'down', 'disabled'


demo:

var btn = new Hilo.Button({
    image: buttonImage,
    upState: {rect:[0, 0, 64, 64]},
    overState: {rect:[64, 0, 64, 64]},
    downState: {rect:[128, 0, 64, 64]},
    disabledState: {rect:[192, 0, 64, 64]}
});

Properties

Show Inherited Properties
Property Defined
disabledState:Object
The property of button 'disabled' state or collections of its drawable properties.
Button
downState:Object
The property of button 'down' state or collections of its drawable properties.
Button
enabled:Boolean
Is button enabled.
Button
overState:Object
The property of button 'over' state or collections of its drawable properties.
Button
state:String
the state name of button, could be one of Button.UP|OVER|DOWN|DISABLED, readonly!
Button
upState:Object
The property of button 'up' state or collections of its drawable properties.
Button
useHandCursor:Boolean
If true, cursor over the button will become a pointer cursor, default value is true.
Button
OVER:String
static Statics value of Button's 'over' state.
Button
DOWN:String
static Statics value of Button's 'down' state.
Button
DISABLED:String
static Statics value of Button's 'disabled' state.
Button
UP:String
static Statics value of Button's 'up' state.
Button

Methods

Show Inherited Methods
Method Defined
Button(properties:Object)
Constructor
Button
setEnabled(enabled:Boolean):Button
Set whether the button is enabled.
Button
setState(state:String):Button
Set the state of the button.
Button

Property Detail

[Static] DISABLED:String
Statics value of Button's 'disabled' state.
disabledState:Object
The property of button 'disabled' state or collections of its drawable properties.
[Static] DOWN:String
Statics value of Button's 'down' state.
downState:Object
The property of button 'down' state or collections of its drawable properties.
enabled:Boolean
Is button enabled. default value is true, readonly!
[Static] OVER:String
Statics value of Button's 'over' state.
overState:Object
The property of button 'over' state or collections of its drawable properties.
state:String
the state name of button, could be one of Button.UP|OVER|DOWN|DISABLED, readonly!
[Static] UP:String
Statics value of Button's 'up' state.
upState:Object
The property of button 'up' state or collections of its drawable properties.
useHandCursor:Boolean
If true, cursor over the button will become a pointer cursor, default value is true.

Constructor

Button(properties:Object)
parameters
properties:Object — create object properties. Contains all writable properties. Also contains:
  • image - the image element that button image is in

Method Detail

setEnabled(enabled:Boolean):Button
Set whether the button is enabled.
parameters
enabled:Boolean — Show whether the button is enabled.
return
Button — Return the button itself.
setState(state:String):Button
Set the state of the button. Invoke inside the Button and may not be used.
parameters
state:String — New state of the button.
return
Button — Return the button itself.