Class: UIButtonRadio

PhaserComps.UIComponents. UIButtonRadio

Radio button. Several radio buttons can be grouped by appending them to the first button in the group, You can do it via passing first button to appendTo constructor argument of other instances,шаг or use appendToRadio method.


new UIButtonRadio( [parent] [, key] [, labelText] [, value] [, appendTo])

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

value * <optional>

Any value, applied to current radio button instance. Use it to find out, what is the current selected value in the group, or select radio by provided value

appendTo UIButtonRadio <optional>

If specified, this instance will be appended to provided radio group immediately

Properties:
Name Type Description
select Boolean

set or get, if current instance selected

value *

get or set current instance value

valueSelected *

If read, returns value of currently selected radio instance in the group. If assigned, selects radio which has provided value.

Fires:
  • PhaserComps.UIComponents.UIButton.event:EVENT_SELECT

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:
Overrides:

appendToRadio(radio)

Append this radio instance to provided radio sibling ring

Parameters:
Name Type Description
radio UIButtonRadio

radio button to append to sibling ring


<protected> destroy( [fromScene])

Destroy ComponentPrototype and clip, if exists

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

<protected> doState()

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

Inherited From:
Overrides:
See:

<protected> getStateId()

Current state id, used by doState method

Inherited From:
Returns:
Type
String

getText(key)

Returns saved text by key, if it was set previously

Parameters:
Name Type Description
key String
Inherited From:
Overrides:
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:
Overrides:

removeFromSibling()

Remove this radio button from sibling ring


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:
Overrides:

Events


EVENT_SELECT

Fired when some radio button of the group is selected