Button

Function Description
activate()

Triggers the action assigned to the button as if it was tapped.

isVisible()

Returns true if the Button is visible, false if not. If a Button is not visible it cannot be tapped.

onClick

Function assigned to this property will be executed when user touches the button.

opacity()

Returns the opacity of the button.

position()

Returns position of the button.

rotation()

Returns the rotation of the button.

scale()

Returns the scale of the button.

setOpacity(value)

Sets the opacity of a button. Note: Setting the opacity to 0 will make the button invisible, but still tappable. If you’d like to hide a button entirely, use setVisible(false).

setPosition(value)

Sets the screen position of the button.

setRotation(value)

Sets the 2D rotation of the button in degrees.

setScale(value)

Sets the 2D scale of the button.

setVisible(value)

Sets the visibility of a button. If a button is not visible, it cannot be tapped. If you’d like an invisible but tappable button, use setOpacity(0).


activate()

Triggers the action assigned to the button as if it was tapped.

↑ Back to top


isVisible()

Returns true if the Button is visible, false if not. If a Button is not visible it cannot be tapped.

Returns

boolean true if the Button is visible, false if not

↑ Back to top


onClick

Function assigned to this property will be executed when user touches the button.

  let button = this.ui().find('MyButton')[0];
  button.onClick = function(){
    Ads.showInterstitial();
  }

↑ Back to top


opacity()

Returns the opacity of the button.

Returns

number the opacity of the button. Range: 0-255.

↑ Back to top


position()

Returns position of the button.

Returns

Vec3 {x, y, z} position of the button.

↑ Back to top


rotation()

Returns the rotation of the button.

Returns

Vec3 {x, y, z} rotation of the button.

↑ Back to top


scale()

Returns the scale of the button.

Returns

Vec {x, y, z} scale of the button.

↑ Back to top


setOpacity(value)

Sets the opacity of a button. Note: Setting the opacity to 0 will make the button invisible, but still tappable. If you’d like to hide a button entirely, use setVisible(false).

Parameters

number value – Range: 0-255. The lower the value, the less opaque the button becomes.

↑ Back to top


setPosition(value)

Sets the screen position of the button.

Parameters

Vec2 value – the {x, y} position

↑ Back to top


setRotation(value)

Sets the 2D rotation of the button in degrees.

Parameters

number value – the new rotation in degrees

↑ Back to top


setScale(value)

Sets the 2D scale of the button.

Parameters

Vec2 value – the {x, y} new scale

↑ Back to top


setVisible(value)

Sets the visibility of a button. If a button is not visible, it cannot be tapped. If you’d like an invisible but tappable button, use setOpacity(0).

Parameters

boolean value – true for visible, false for not visible.

↑ Back to top

Did you find this page useful?

Please give it a rating:

Please provide some feedback!

This is very helpful to us.

Tell us how we can improve this post?