button(x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame) → {Phaser.Button}
Creates a new Button object.
Parameters
Name | Type | Argument | Description |
---|---|---|---|
x | number | <optional> | X position of the new button object. |
y | number | <optional> | Y position of the new button object. |
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. |
Returns
The newly created button object.
- Source code: gameobjects/GameObjectCreator.js (Line 215)
Please login to continue.