Phaser. Events

Phaser.Events

new Events(sprite)

The Events component is a collection of events fired by the parent game object.

For example to tell when a Sprite has been added to a new group:

sprite.events.onAddedToGroup.add(yourFunction, this);

Where yourFunction is the function you want called when this event occurs.

Note that the Input related events only exist if the Sprite has had inputEnabled set to true.

Parameters:
Name Type Description
sprite Phaser.Sprite

A reference to the Sprite that owns this Events object.

Source - gameobjects/Events.js, line 22

Members

onAddedToGroup :Phaser.Signal

This signal is dispatched when the parent is added to a new Group.

Source - gameobjects/Events.js, line 32

onAnimationComplete :Phaser.Signal

This signal is dispatched when the parent has an animation that finishes playing.

Default Value:
  • null
Source - gameobjects/Events.js, line 115

onAnimationLoop :Phaser.Signal

This signal is dispatched when the parent has an animation that loops playback.

Default Value:
  • null
Source - gameobjects/Events.js, line 121

onAnimationStart :Phaser.Signal

This signal is dispatched when the parent has an animation that is played.

Default Value:
  • null
Source - gameobjects/Events.js, line 109

onDestroy :Phaser.Signal

This signal is dispatched when the parent is destoyed.

Source - gameobjects/Events.js, line 47

onDragStart :Phaser.Signal

This signal is dispatched if the parent is inputEnabled and receives a drag start event from a Pointer.

Default Value:
  • null
Source - gameobjects/Events.js, line 97

onDragStop :Phaser.Signal

This signal is dispatched if the parent is inputEnabled and receives a drag stop event from a Pointer.

Default Value:
  • null
Source - gameobjects/Events.js, line 103

onEnterBounds :Phaser.Signal

This signal is dispatched when the parent returns within the world bounds (only if Sprite.checkWorldBounds is true).

Source - gameobjects/Events.js, line 67

onInputDown :Phaser.Signal

This signal is dispatched if the parent is inputEnabled and receives a down event from a Pointer.

Default Value:
  • null
Source - gameobjects/Events.js, line 85

onInputOut :Phaser.Signal

This signal is dispatched if the parent is inputEnabled and receives an out event from a Pointer.

Default Value:
  • null
Source - gameobjects/Events.js, line 79

onInputOver :Phaser.Signal

This signal is dispatched if the parent is inputEnabled and receives an over event from a Pointer.

Default Value:
  • null
Source - gameobjects/Events.js, line 73

onInputUp :Phaser.Signal

This signal is dispatched if the parent is inputEnabled and receives an up event from a Pointer.

Default Value:
  • null
Source - gameobjects/Events.js, line 91

onKilled :Phaser.Signal

This signal is dispatched when the parent is killed.

Source - gameobjects/Events.js, line 52

onOutOfBounds :Phaser.Signal

This signal is dispatched when the parent leaves the world bounds (only if Sprite.checkWorldBounds is true).

Source - gameobjects/Events.js, line 62

onRemovedFromGroup :Phaser.Signal

This signal is dispatched when the parent is removed from a Group.

Source - gameobjects/Events.js, line 37

onRemovedFromWorld :Phaser.Signal

This signal is dispatched if this item or any of its parents are removed from the game world.

Source - gameobjects/Events.js, line 42

onRevived :Phaser.Signal

This signal is dispatched when the parent is revived.

Source - gameobjects/Events.js, line 57

parent :Phaser.Sprite

The Sprite that owns these events.

Source - gameobjects/Events.js, line 27

Methods

destroy()

Removes all events.

Source - gameobjects/Events.js, line 127
Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Tue Nov 25 2014 00:17:30 GMT-0000 (GMT) using the DocStrap template.