- Source: src/scene/events/index.js (Line 7)
Events
-
ADDED_TO_SCENE
-
The Game Object Added to Scene Event.
This event is dispatched when a Game Object is added to a Scene.
Listen for it from a Scene using
this.scene.events.on('addedtoscene', listener).Parameters:
Name Type Description gameObjectPhaser.GameObjects.GameObject The Game Object that was added to the Scene.
scenePhaser.Scene The Scene to which the Game Object was added.
- Since: 3.50.0
- Source: src/scene/events/ADDED_TO_SCENE_EVENT.js (Line 7)
-
BOOT
-
The Scene Systems Boot Event.
This event is dispatched by a Scene during the Scene Systems boot process. Primarily used by Scene Plugins.
Listen to it from a Scene using
this.scene.events.on('boot', listener).Parameters:
Name Type Description sysPhaser.Scenes.Systems A reference to the Scene Systems class of the Scene that emitted this event.
- Since: 3.0.0
- Source: src/scene/events/BOOT_EVENT.js (Line 7)
-
CREATE
-
The Scene Create Event.
This event is dispatched by a Scene after it has been created by the Scene Manager.
If a Scene has a
createmethod then this event is emitted after that has run.If there is a transition, this event will be fired after the
TRANSITION_STARTevent.Listen to it from a Scene using
this.scene.events.on('create', listener).Parameters:
Name Type Description scenePhaser.Scene A reference to the Scene that emitted this event.
- Since: 3.17.0
- Source: src/scene/events/CREATE_EVENT.js (Line 7)
-
DESTROY
-
The Scene Systems Destroy Event.
This event is dispatched by a Scene during the Scene Systems destroy process.
Listen to it from a Scene using
this.scene.events.on('destroy', listener).You should destroy any resources that may be in use by your Scene in this event handler.
Parameters:
Name Type Description sysPhaser.Scenes.Systems A reference to the Scene Systems class of the Scene that emitted this event.
- Since: 3.0.0
- Source: src/scene/events/DESTROY_EVENT.js (Line 7)
-
PAUSE
-
The Scene Systems Pause Event.
This event is dispatched by a Scene when it is paused, either directly via the
pausemethod, or as an action from another Scene.Listen to it from a Scene using
this.scene.events.on('pause', listener).Parameters:
Name Type Argument Description sysPhaser.Scenes.Systems A reference to the Scene Systems class of the Scene that emitted this event.
dataany <optional>
An optional data object that was passed to this Scene when it was paused.
- Since: 3.0.0
- Source: src/scene/events/PAUSE_EVENT.js (Line 7)
-
POST_UPDATE
-
The Scene Systems Post Update Event.
This event is dispatched by a Scene during the main game loop step.
The event flow for a single step of a Scene is as follows:
PRE_UPDATEUPDATE- The
Scene.updatemethod is called, if it exists POST_UPDATERENDER
Listen to it from a Scene using
this.scene.events.on('postupdate', listener).A Scene will only run its step if it is active.
Parameters:
Name Type Description sysPhaser.Scenes.Systems A reference to the Scene Systems class of the Scene that emitted this event.
timenumber The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
deltanumber The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.
- Since: 3.0.0
- Source: src/scene/events/POST_UPDATE_EVENT.js (Line 7)
-
PRE_UPDATE
-
The Scene Systems Pre Update Event.
This event is dispatched by a Scene during the main game loop step.
The event flow for a single step of a Scene is as follows:
PRE_UPDATEUPDATE- The
Scene.updatemethod is called, if it exists POST_UPDATERENDER
Listen to it from a Scene using
this.scene.events.on('preupdate', listener).A Scene will only run its step if it is active.
Parameters:
Name Type Description sysPhaser.Scenes.Systems A reference to the Scene Systems class of the Scene that emitted this event.
timenumber The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
deltanumber The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.
- Since: 3.0.0
- Source: src/scene/events/PRE_UPDATE_EVENT.js (Line 7)
-
READY
-
The Scene Systems Ready Event.
This event is dispatched by a Scene during the Scene Systems start process. By this point in the process the Scene is now fully active and rendering. This event is meant for your game code to use, as all plugins have responded to the earlier 'start' event.
Listen to it from a Scene using
this.scene.events.on('ready', listener).Parameters:
Name Type Argument Description sysPhaser.Scenes.Systems A reference to the Scene Systems class of the Scene that emitted this event.
dataany <optional>
An optional data object that was passed to this Scene when it was started.
- Since: 3.0.0
- Source: src/scene/events/READY_EVENT.js (Line 7)
-
REMOVED_FROM_SCENE
-
The Game Object Removed from Scene Event.
This event is dispatched when a Game Object is removed from a Scene.
Listen for it from a Scene using
this.scene.events.on('removedfromscene', listener).Parameters:
Name Type Description gameObjectPhaser.GameObjects.GameObject The Game Object that was removed from the Scene.
scenePhaser.Scene The Scene from which the Game Object was removed.
- Since: 3.50.0
- Source: src/scene/events/REMOVED_FROM_SCENE_EVENT.js (Line 7)
-
RENDER
-
The Scene Systems Render Event.
This event is dispatched by a Scene during the main game loop step.
The event flow for a single step of a Scene is as follows:
PRE_UPDATEUPDATE- The
Scene.updatemethod is called, if it exists POST_UPDATERENDER
Listen to it from a Scene using
this.scene.events.on('render', listener).A Scene will only render if it is visible and active. By the time this event is dispatched, the Scene will have already been rendered.
Parameters:
Name Type Description rendererPhaser.Renderer.Canvas.CanvasRenderer | Phaser.Renderer.WebGL.WebGLRenderer The renderer that rendered the Scene.
- Since: 3.0.0
- Source: src/scene/events/RENDER_EVENT.js (Line 7)
-
RESUME
-
The Scene Systems Resume Event.
This event is dispatched by a Scene when it is resumed from a paused state, either directly via the
resumemethod, or as an action from another Scene.Listen to it from a Scene using
this.scene.events.on('resume', listener).Parameters:
Name Type Argument Description sysPhaser.Scenes.Systems A reference to the Scene Systems class of the Scene that emitted this event.
dataany <optional>
An optional data object that was passed to this Scene when it was resumed.
- Since: 3.0.0
- Source: src/scene/events/RESUME_EVENT.js (Line 7)
-
SHUTDOWN
-
The Scene Systems Shutdown Event.
This event is dispatched by a Scene during the Scene Systems shutdown process.
Listen to it from a Scene using
this.scene.events.on('shutdown', listener).You should free-up any resources that may be in use by your Scene in this event handler, on the understanding that the Scene may, at any time, become active again. A shutdown Scene is not 'destroyed', it's simply not currently active. Use the
DESTROYevent to completely clear resources.Parameters:
Name Type Argument Description sysPhaser.Scenes.Systems A reference to the Scene Systems class of the Scene that emitted this event.
dataany <optional>
An optional data object that was passed to this Scene when it was shutdown.
- Since: 3.0.0
- Source: src/scene/events/SHUTDOWN_EVENT.js (Line 7)
-
SLEEP
-
The Scene Systems Sleep Event.
This event is dispatched by a Scene when it is sent to sleep, either directly via the
sleepmethod, or as an action from another Scene.Listen to it from a Scene using
this.scene.events.on('sleep', listener).Parameters:
Name Type Argument Description sysPhaser.Scenes.Systems A reference to the Scene Systems class of the Scene that emitted this event.
dataany <optional>
An optional data object that was passed to this Scene when it was sent to sleep.
- Since: 3.0.0
- Source: src/scene/events/SLEEP_EVENT.js (Line 7)
-
START
-
The Scene Systems Start Event.
This event is dispatched by a Scene during the Scene Systems start process. Primarily used by Scene Plugins.
Listen to it from a Scene using
this.scene.events.on('start', listener).Parameters:
Name Type Description sysPhaser.Scenes.Systems A reference to the Scene Systems class of the Scene that emitted this event.
- Since: 3.0.0
- Source: src/scene/events/START_EVENT.js (Line 7)
-
TRANSITION_COMPLETE
-
The Scene Transition Complete Event.
This event is dispatched by the Target Scene of a transition.
It happens when the transition process has completed. This occurs when the duration timer equals or exceeds the duration of the transition.
Listen to it from a Scene using
this.scene.events.on('transitioncomplete', listener).The Scene Transition event flow is as follows:
TRANSITION_OUT- the Scene that started the transition will emit this event.TRANSITION_INIT- the Target Scene will emit this event if it has aninitmethod.TRANSITION_START- the Target Scene will emit this event after itscreatemethod is called, OR ...TRANSITION_WAKE- the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to.TRANSITION_COMPLETE- the Target Scene will emit this event when the transition finishes.
Parameters:
Name Type Description scenePhaser.Scene The Scene on which the transitioned completed.
- Since: 3.5.0
- Source: src/scene/events/TRANSITION_COMPLETE_EVENT.js (Line 7)
-
TRANSITION_INIT
-
The Scene Transition Init Event.
This event is dispatched by the Target Scene of a transition.
It happens immediately after the
Scene.initmethod is called. If the Scene does not have aninitmethod, this event is not dispatched.Listen to it from a Scene using
this.scene.events.on('transitioninit', listener).The Scene Transition event flow is as follows:
TRANSITION_OUT- the Scene that started the transition will emit this event.TRANSITION_INIT- the Target Scene will emit this event if it has aninitmethod.TRANSITION_START- the Target Scene will emit this event after itscreatemethod is called, OR ...TRANSITION_WAKE- the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to.TRANSITION_COMPLETE- the Target Scene will emit this event when the transition finishes.
Parameters:
Name Type Description fromPhaser.Scene A reference to the Scene that is being transitioned from.
durationnumber The duration of the transition in ms.
- Since: 3.5.0
- Source: src/scene/events/TRANSITION_INIT_EVENT.js (Line 7)
-
TRANSITION_OUT
-
The Scene Transition Out Event.
This event is dispatched by a Scene when it initiates a transition to another Scene.
Listen to it from a Scene using
this.scene.events.on('transitionout', listener).The Scene Transition event flow is as follows:
TRANSITION_OUT- the Scene that started the transition will emit this event.TRANSITION_INIT- the Target Scene will emit this event if it has aninitmethod.TRANSITION_START- the Target Scene will emit this event after itscreatemethod is called, OR ...TRANSITION_WAKE- the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to.TRANSITION_COMPLETE- the Target Scene will emit this event when the transition finishes.
Parameters:
Name Type Description targetPhaser.Scene A reference to the Scene that is being transitioned to.
durationnumber The duration of the transition in ms.
- Since: 3.5.0
- Source: src/scene/events/TRANSITION_OUT_EVENT.js (Line 7)
-
TRANSITION_START
-
The Scene Transition Start Event.
This event is dispatched by the Target Scene of a transition, only if that Scene was not asleep.
It happens immediately after the
Scene.createmethod is called. If the Scene does not have acreatemethod, this event is dispatched anyway.If the Target Scene was sleeping then the
TRANSITION_WAKEevent is dispatched instead of this event.Listen to it from a Scene using
this.scene.events.on('transitionstart', listener).The Scene Transition event flow is as follows:
TRANSITION_OUT- the Scene that started the transition will emit this event.TRANSITION_INIT- the Target Scene will emit this event if it has aninitmethod.TRANSITION_START- the Target Scene will emit this event after itscreatemethod is called, OR ...TRANSITION_WAKE- the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to.TRANSITION_COMPLETE- the Target Scene will emit this event when the transition finishes.
Parameters:
Name Type Description fromPhaser.Scene A reference to the Scene that is being transitioned from.
durationnumber The duration of the transition in ms.
- Since: 3.5.0
- Source: src/scene/events/TRANSITION_START_EVENT.js (Line 7)
-
TRANSITION_WAKE
-
The Scene Transition Wake Event.
This event is dispatched by the Target Scene of a transition, only if that Scene was asleep before the transition began. If the Scene was not asleep the
TRANSITION_STARTevent is dispatched instead.Listen to it from a Scene using
this.scene.events.on('transitionwake', listener).The Scene Transition event flow is as follows:
TRANSITION_OUT- the Scene that started the transition will emit this event.TRANSITION_INIT- the Target Scene will emit this event if it has aninitmethod.TRANSITION_START- the Target Scene will emit this event after itscreatemethod is called, OR ...TRANSITION_WAKE- the Target Scene will emit this event if it was asleep and has been woken-up to be transitioned to.TRANSITION_COMPLETE- the Target Scene will emit this event when the transition finishes.
Parameters:
Name Type Description fromPhaser.Scene A reference to the Scene that is being transitioned from.
durationnumber The duration of the transition in ms.
- Since: 3.5.0
- Source: src/scene/events/TRANSITION_WAKE_EVENT.js (Line 7)
-
UPDATE
-
The Scene Systems Update Event.
This event is dispatched by a Scene during the main game loop step.
The event flow for a single step of a Scene is as follows:
PRE_UPDATEUPDATE- The
Scene.updatemethod is called, if it exists POST_UPDATERENDER
Listen to it from a Scene using
this.scene.events.on('update', listener).A Scene will only run its step if it is active.
Parameters:
Name Type Description sysPhaser.Scenes.Systems A reference to the Scene Systems class of the Scene that emitted this event.
timenumber The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
deltanumber The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.
- Since: 3.0.0
- Source: src/scene/events/UPDATE_EVENT.js (Line 7)
-
WAKE
-
The Scene Systems Wake Event.
This event is dispatched by a Scene when it is woken from sleep, either directly via the
wakemethod, or as an action from another Scene.Listen to it from a Scene using
this.scene.events.on('wake', listener).Parameters:
Name Type Argument Description sysPhaser.Scenes.Systems A reference to the Scene Systems class of the Scene that emitted this event.
dataany <optional>
An optional data object that was passed to this Scene when it was woken up.
- Since: 3.0.0
- Source: src/scene/events/WAKE_EVENT.js (Line 7)
