KoolMoves AS3 API Documentation | All Packages | All Classes | Index | Frames No Frames |
Class BaseButton

Package | km.components
Class | public class BaseButton
Inheritance | BaseButton UIComponent flash.display.Sprite
Subclasses | LabelButton

The BaseButton class is the base class for button components.

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined by
--- | --- | ---
|  | duotone : Array The duotone property can be used to convert the colors of the component into duotone. | UIComponent
|  | effectSpeed : int Speed in msec of the mouse over fade effect. | BaseButton
|  | enabled : Boolean Specifies if the component is enabled. If a component is disabled, it will be turned into grayscale and become partly transparent. | UIComponent
|  | height : Number | UIComponent
|  | minHeight : int [read-only] Returns the minimum height of the button based on its scaling grid. | BaseButton
|  | minWidth : int [read-only] Returns the minimum width of the button based on its scaling grid. | BaseButton
|  | on : Boolean Specifies the on/off state when the button is operating in hold or switch mode. | BaseButton
|  | onClick : Function onClick handler. | BaseButton
|  | operationMode : int Specifies the operation mode of the button. 0 = normal, 1 = hold, 2 = switch. | BaseButton
|  | origHeight : int [read-only] Returns the original height of the button. | BaseButton
|  | origWidth : int [read-only] Returns the original width of the button. | BaseButton
|  | smoothing : Boolean [write-only] Sets the way the scaling grid is used. | BaseButton
|  | toolTip : String Text to use as toolTip when ToolTip is enabled. | UIComponent
|  | width : Number | UIComponent
|  | x : Number | UIComponent
|  | y : Number | UIComponent

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined by
--- | --- | ---
|  | BaseButton() | BaseButton
|  | clone():* Returns a clone of the component. The skin of the component is cloned but other things like the text of a label or the items of a list aren't. | UIComponent
|  | move(x:int, y:int, animationMode:int = 0, animationFrames:int = 12, easeInOut:Boolean = false):void Moves the component to the specified coordinates. | UIComponent
|  | setProperties(o:Object):void Sets a number of properties at once. | UIComponent
|  | setSize(w:int, h:int):void Sets the size width and height. | UIComponent
|  | setSkin(assetName:String, usePrefix:Boolean = true):void Sets the skin asset. | BaseButton
|  | setSound(mouseDownSound:Sound = null, mouseOverSound:Sound = null):void Sets the sounds of a button. | BaseButton

Events
Hide Inherited Events
Show Inherited Events

| Event | Summary | Defined by
--- | --- | --- | ---
|  | animationComplete | The animationComplete event is broadcasted when an animated move is completed. | UIComponent
|  | click | The click event is broadcasted when the button is clicked. It's also possible to use the onClick handler. | BaseButton

Property detail

effectSpeed | property

`effectSpeed:int` [read-write]

Speed in msec of the mouse over fade effect. When this value is non zero, the up and over states are displayed using a cross fade. In this case, when the button is in up or over state, the up state will be visible all the time and the over state alpha will change.

Implementation
`public function get effectSpeed():int`
`public function set effectSpeed(value:int):void`

minHeight | property |

`minHeight:int` [read-only]

Returns the minimum height of the button based on its scaling grid.

Implementation
`public function get minHeight():int`

minWidth | property |

`minWidth:int` [read-only]

Returns the minimum width of the button based on its scaling grid.

Implementation
`public function get minWidth():int`

on | property |

`on:Boolean` [read-write]

Specifies the on/off state when the button is operating in hold or switch mode.

Implementation
`public function get on():Boolean`
`public function set on(value:Boolean):void`

onClick | property |

`public var onClick:Function`

onClick handler.

operationMode | property |

`operationMode:int` [read-write]

Specifies the operation mode of the button.
0 = normal, 1 = hold, 2 = switch.

Implementation
`public function get operationMode():int`
`public function set operationMode(value:int):void`

origHeight | property |

`origHeight:int` [read-only]

Returns the original height of the button.

Implementation
`public function get origHeight():int`

origWidth | property |

`origWidth:int` [read-only]

Returns the original width of the button.

Implementation
`public function get origWidth():int`

smoothing | property |

`smoothing:Boolean` [write-only]

Sets the way the scaling grid is used.

Implementation
`public function set smoothing(value:Boolean):void`
Constructor detail

BaseButton | () | constructor

`public function BaseButton()`
Method detail

setSkin | () | method

`public function setSkin(assetName:String, usePrefix:Boolean = true):void`

Sets the skin asset. It works the same as for the Image class. The difference is that the bitmap image to use has to be a three state image. This means the image has to contain the up, over and down states below eachother in one single file.

Parameters

| `assetName:String`
| `usePrefix:Boolean` (default = `true`)``

See also

km.core.Image.setSkin()

setSound | () | method |

`public function setSound(mouseDownSound:Sound = null, mouseOverSound:Sound = null):void`

Sets the sounds of a button.

Parameters

| `mouseDownSound:Sound` (default = `null`)``
| `mouseOverSound:Sound` (default = `null`)``

Event detail

click | event

Event object type: `flash.events.MouseEvent`

The click event is broadcasted when the button is clicked.
It's also possible to use the onClick handler.

Last update : 04/05/2008