button(x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame, group) → {Phaser.Button}
Creates a new Button object.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
x | number | <optional> | 0 | The x coordinate of the Button. The coordinate is relative to any parent container this button may be in. |
y | number | <optional> | 0 | The y coordinate of the Button. The coordinate is relative to any parent container this button may be in. |
key | string | <optional> | The image key as defined in the Game.Cache to use as the texture for this button. | |
callback | function | <optional> | The function to call when this button is pressed | |
callbackContext | object | <optional> | The context in which the callback will be called (usually 'this') | |
overFrame | string | number | <optional> | This is the frame or frameName that will be set when this button is in an over state. Give either a number to use a frame ID or a string for a frame name. | |
outFrame | string | number | <optional> | This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name. | |
downFrame | string | number | <optional> | This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name. | |
upFrame | string | number | <optional> | This is the frame or frameName that will be set when this button is in an up state. Give either a number to use a frame ID or a string for a frame name. | |
group | Phaser.Group | <optional> | Optional Group to add the object to. If not specified it will be added to the World group. |
Returns
The newly created Button object.
- Source code: gameobjects/GameObjectFactory.js (Line 337)
Please login to continue.