Class: Button

Phaser. Button

Phaser.Button

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

Properties:
Name Type Description
onInputDown Phaser.Signal

Description.

Source:

onInputOut

Properties:
Name Type Description
onInputOut Phaser.Signal

Description.

Source:

onInputOver

Properties:
Name Type Description
onInputOver Phaser.Signal

Description.

Source:

onInputUp

Properties:
Name Type Description
onInputUp Phaser.Signal

Description.

Source:

type

Properties:
Name Type Description
type Description

Description.

Source:

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:
Phaser Copyright © 2012-2013 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Fri Oct 25 2013 16:16:44 GMT+0100 (BST) using the DocStrap template.