Class List

Class Button

Extends MovieClip.
This class is the Button implementation in HTML5 Canvas.
You can specify mouse handlers for specific events. You can also change the appearance of the button by associating a different skin with each button state.

Class Summary
Constructor Attributes Constructor Name and Description
 
Button(upState, overState, downState, disabledState)
Constructor.
Field Summary
Field Attributes Field Name and Description
 
A Boolean value that indicates whether the button can accept mouse events.
 
Current button state name.
<static>  
State constant of "disabled".
<static>  
Button.state.DOWN
State constant of "down".
<static>  
Button.state.OVER
State constant of "over".
<static>  
Button.state.UP
State constant of "up".
Fields borrowed from class MovieClip:
currentFrame
Fields borrowed from class DisplayObjectContainer:
children, mouseChildren
Fields borrowed from class DisplayObject:
alpha, height, id, mouseEnabled, name, parent, regX, regY, rotation, scaleX, scaleY, stage, useHandCursor, visible, width, x, y
Method Summary
Method Attributes Method Name and Description
 
onMouseDown(event)
A Handler for mouse down event.
 
onMouseMove(event)
A Handler for mouse move event.
 
onMouseOut(event)
A Handler for mouse out event.
 
onMouseOver(event)
A Handler for mouse over event.
 
onMouseUp(event)
A Handler for mouse up event.
 
setDisabledState(disabledState)
Sets display object for the disbaled state.
 
setDownState(downState)
Sets display object for the mouse down state.
 
setEnabled(enabled)
Enables or disables the button.
 
setOverState(overState)
Sets display object for the mouse over state.
 
setState(state)
Sets the button's state name.
 
setUpState(upState)
Sets display object for the normal state.
Methods borrowed from class MovieClip:
addFrame, addFrameAt, getFrame, getFrameNumber, getTotalFrames, gotoAndPlay, gotoAndStop, nextFrame, play, removeFrame, stop
Methods borrowed from class DisplayObjectContainer:
addChild, addChildAt, contains, getChildAt, getChildByName, getChildIndex, getNumChildren, getObjectUnderPoint, removeAllChildren, removeChild, removeChildAt, removeChildByName, setChildIndex
Methods borrowed from class DisplayObject:
getCurrentHeight, getCurrentWidth, getRect, getStage, globalToLocal, hitTestObject, hitTestPoint, localToGlobal, localToTarget, onMouseEvent, render, toString
Methods borrowed from class EventDispatcher:
addEventListener, dispatchEvent, hasEventListener, removeAllEventListeners, removeEventListener, removeEventListenerByType
Class Detail
Button(upState, overState, downState, disabledState)
Constructor.
Parameters:
upState
A display object for normal state.
overState
A display object for mouse over state, optional.
downState
A display object for mouse down state, optional.
disabledState
A display object for disabled state, optional.
Field Detail
enabled
A Boolean value that indicates whether the button can accept mouse events.

state
Current button state name.

<static> Button.state.DISABLED
State constant of "disabled".

<static> Button.state.DOWN
State constant of "down".

<static> Button.state.OVER
State constant of "over".

<static> Button.state.UP
State constant of "up".
Method Detail
onMouseDown(event)
A Handler for mouse down event. Default is null.
Parameters:
event

onMouseMove(event)
A Handler for mouse move event. Default is null.
Parameters:
event

onMouseOut(event)
A Handler for mouse out event. Default is null.
Parameters:
event

onMouseOver(event)
A Handler for mouse over event. Default is null.
Parameters:
event

onMouseUp(event)
A Handler for mouse up event. Default is null.
Parameters:
event

setDisabledState(disabledState)
Sets display object for the disbaled state.
Parameters:
disabledState

setDownState(downState)
Sets display object for the mouse down state.
Parameters:
downState

setEnabled(enabled)
Enables or disables the button.
Parameters:
enabled

setOverState(overState)
Sets display object for the mouse over state.
Parameters:
overState

setState(state)
Sets the button's state name. Developers can use it to change button state manually.
Parameters:
state

setUpState(upState)
Sets display object for the normal state.
Parameters:
upState

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Jul 25 2011 15:02:39 GMT+0800 (CST)