new Button(game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame)
Create a new <code>Button</code> object.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
game |
Phaser.Game | Current game instance. |
|
x |
number |
<optional> |
X position of the button. |
y |
number |
<optional> |
Y position of the button. |
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. |
- Source:
Members
-
onInputDown
-
- Source:
Properties:
Name Type Description onInputDown
Phaser.Signal Description.
-
onInputOut
-
- Source:
Properties:
Name Type Description onInputOut
Phaser.Signal Description.
-
onInputOver
-
- Source:
Properties:
Name Type Description onInputOver
Phaser.Signal Description.
-
onInputUp
-
- Source:
Properties:
Name Type Description onInputUp
Phaser.Signal Description.
-
type
-
- Source:
Properties:
Name Type Description type
Description Description.
Methods
-
onInputDownHandler(pointer)
-
Description.
Parameters:
Name Type Description pointer
Description Description.
- Source:
-
onInputOutHandler(pointer)
-
Description.
Parameters:
Name Type Description pointer
Description Description.
- Source:
-
onInputOverHandler(pointer)
-
Description.
Parameters:
Name Type Description pointer
Description Description.
- Source:
-
onInputUpHandler(pointer)
-
Description.
Parameters:
Name Type Description pointer
Description Description.
- Source:
-
setFrames(overFrame, outFrame, downFrame)
-
Used to manually set the frames that will be used for the different states of the button exactly like setting them in the constructor.
Parameters:
Name Type Argument Description 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.
- Source: