Class: UIButtonSelect

PhaserComps.UIComponents. UIButtonSelect

Checkbox-like button component prototype. Has states up, over, down, disable, up_select, over_select, down_select, disable_select, Emits EVENT_CLICK on click. When disabled, doesn't interact to mouse events and move to state disable


new UIButtonSelect( [parent] [, key] [, labelText])

Parameters:
Name Type Argument Description
parent PhaserComps.UIComponents.UIComponentPrototype <optional>

UIComponentPrototype instance to find clip inside

key String <optional>

key to find clip inside parent

labelText String <optional>

text to set for a 'label' key

Properties:
Name Type Description
enable Boolean

activate/deactivate button interaction. if false, button state is set to disable

label String

get/set button label text

select Boolean

get/set switch

Fires:

Extends

Methods


<protected> _onClick()

called when button hit zone clicked, emits EVENT_CLICK

Inherited From:
Overrides:

appendClip(clip)

Append a instance to this to control it. State setup will be processed immediately.
Use only for root instance, child instances will be appended automatically depending on state of this.

Parameters:
Name Type Description
clip PhaserComps.ComponentClip

ComponentView instance to append

Inherited From:

<protected> destroy( [fromScene])

Destroy ComponentPrototype and clip, if exists

Parameters:
Name Type Argument Default Description
fromScene Boolean <optional>
false
Inherited From:

<protected> doState()

Call doState to setup new state, id is provided by getStateId

Inherited From:
See:

<protected> getStateId()

Current state id, used by doState method

Inherited From:
Overrides:
Returns:
Type
String

getText(key)

Returns saved text by key, if it was set previously

Parameters:
Name Type Description
key String
Inherited From:
Returns:

text value

Type
String | Array.<String>

<protected> onClipAppend(clip)

Override this, if you want to do something, when new clip removed,

Parameters:
Name Type Description
clip PhaserComps.ComponentClip
Inherited From:

<protected> onClipProcess()

Override this, if you want to do something, when state or clip changes.

Inherited From:

<protected> onClipRemove(clip)

Override this, if you want to do something, when new clip removed, like remove clip events listeners.

Parameters:
Name Type Description
clip
Inherited From:

<protected> removeClip()

Inherited From:

setText(key, text)

Set text value to the textfield with provided key. Text value is saved in the component's instance dictionary and will be set to the textField on every state change

Parameters:
Name Type Description
key String

TextField key

text String | Array.<String>

text string

Inherited From: