# Class: Stage

## Phaser. Stage

Phaser.Stage

#### new Stage(game, width, height)

  The Stage controls the canvas on which everything is displayed. It handles display within the browser, focus handling, game resizing, scaling and the pause, boot and orientation screens.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `game` | Phaser.Game | Game reference to the currently running game.
  `width` | number | Width of the canvas element.
  `height` | number | Height of the canvas element.

  Source:
    - core/Stage.js, line 18

### Extends

- PIXI.Stage

### Members

#### backgroundColor

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `backgroundColor` | number | string | Gets and sets the background color of the stage. The color can be given as a number: 0xff0000 or a hex string: '#ff0000'

  Source:
    - core/Stage.js, line 372

#### bounds

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `bounds` | Phaser.Rectangle | The bounds of the Stage. Typically x/y = Stage.offset.x/y and the width/height match the game width and height.

  Source:
    - core/Stage.js, line 33

#### checkOffsetInterval

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `checkOffsetInterval` | number | false | The time (in ms) between which the stage should check to see if it has moved.

  Default Value:
    - 2500
  Source:
    - core/Stage.js, line 60

#### currentRenderOrderID

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `currentRenderOrderID` | number | Reset each frame, keeps a count of the total number of objects updated.

  Source:
    - core/Stage.js, line 71

#### disableVisibilityChange

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `disableVisibilityChange` | boolean | By default if the browser tab loses focus the game will pause. You can stop that behaviour by setting this property to true.

  Default Value:
    - false
  Source:
    - core/Stage.js, line 54

#### exists

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `exists` | boolean | If exists is true the Stage and all children are updated, otherwise it is skipped.

  Default Value:
    - true
  Source:
    - core/Stage.js, line 66

#### game

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `game` | Phaser.Game | A reference to the currently running Game.

  Source:
    - core/Stage.js, line 23

#### name

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `name` | string | The name of this object.

  Default Value:
    - "_stage_root"
  Source:
    - core/Stage.js, line 41

#### offset

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `offset` | Phaser.Point | Holds the offset coordinates of the Game.canvas from the top-left of the browser window (used by Input and other classes)

  Source:
    - core/Stage.js, line 28

#### setBackgroundColor

  Sets the background color for the Stage. The color can be given as a hex value (#RRGGBB) or a numeric value (0xRRGGBB)

  Source:
    - core/Stage.js, line 348

#### smoothed

  Enable or disable texture smoothing for all objects on this Stage. Only works for bitmap/image textures. Smoothing is enabled by default.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `smoothed` | boolean | Set to true to smooth all sprites rendered on this Stage, or false to disable smoothing (great for pixel art)

  Source:
    - core/Stage.js, line 395

### Methods

#### checkVisibility()

  Starts a page visibility event listener running, or window.blur/focus if not supported by the browser.

  Source:
    - core/Stage.js, line 270

#### <protected> parseConfig()

  Parses a Game configuration object.

  Source:
    - core/Stage.js, line 193

#### postUpdate()

  This is called automatically before the renderer runs and after the plugins have updated. In postUpdate this is where all the final physics calculatations and object positioning happens. The objects are processed in the order of the display list. The only exception to this is if the camera is following an object, in which case that is updated first.

  Source:
    - core/Stage.js, line 142

#### preUpdate()

  This is called automatically after the plugins preUpdate and before the State.update. Most objects have preUpdate methods and it's where initial movement and positioning is done.

  Source:
    - core/Stage.js, line 106

#### update()

  This is called automatically after the State.update, but before particles or plugins update.

  Source:
    - core/Stage.js, line 126

#### visibilityChange(event)

  This method is called when the document visibility is changed.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `event` | Event | Its type will be used to decide whether the game should be paused or not.

  Source:
    - core/Stage.js, line 311