springroll.easeljs.EaselJSDisplay Class

EaselJSDisplay is a display plugin for the springroll Framework that uses the EaselJS library for rendering.

Constructor

springroll.easeljs.EaselJSDisplay

(
  • id
  • options
)

Parameters:

  • id String

    The id of the canvas element on the page to draw to.

  • options Object

    The setup data for the EaselJS stage.

    • [stageType="stage"] String optional

      If the stage should be a normal stage or a SpriteStage (use "spriteStage").

    • [clearView=false] Boolean optional

      If the stage should wipe the canvas between renders.

    • [mouseOverRate=30] Int optional

      How many times per second to check for mouseovers. To disable them, use 0 or -1.

    • [autoPreventDefault=true] Boolean optional

      If preventDefault() should be called on all touch events and mousedown events.

destroy

()

Inherited from springroll.EventDispatcher but overwritten in destroy:185

Destroys the display. This method is called by the Application and should not be called directly, use Application.removeDisplay(id). The stage recursively removes all display objects here.

has

(
  • name
  • [callback]
)
Boolean

Checks if the EventDispatcher has a specific listener or any listener for a given event.

Parameters:

  • name String

    The name of the single event type to check for

  • [callback] Function optional

    The listener function to check for. If omitted, checks for any listener.

Returns:

Boolean:

If the EventDispatcher has the specified listener.

off

(
  • name
  • callback
)
EventDispatcher

Remove the event listener

Parameters:

  • name String*

    The type of event string separated by spaces, if no name is specifed remove all listeners.

  • callback Function | Array*

    The listener function or collection of callback functions

Returns:

EventDispatcher:

Return this EventDispatcher for chaining calls.

on

(
  • name
  • callback
  • [priority=0]
)
EventDispatcher

Add an event listener. The parameters for the listener functions depend on the event.

Parameters:

  • name String | Object

    The type of event (can be multiple events separated by spaces), or a map of events to handlers

  • callback Function | Array*

    The callback function when event is fired or an array of callbacks.

  • [priority=0] Int optional

    The priority of the event listener. Higher numbers are handled first.

Returns:

EventDispatcher:

Return this EventDispatcher for chaining calls.

once

(
  • name
  • callback
  • [priority=0]
)
EventDispatcher

Add an event listener but only handle it one time.

Parameters:

  • name String | Object

    The type of event (can be multiple events separated by spaces), or a map of events to handlers

  • callback Function | Array*

    The callback function when event is fired or an array of callbacks.

  • [priority=0] Int optional

    The priority of the event listener. Higher numbers are handled first.

Returns:

EventDispatcher:

Return this EventDispatcher for chaining calls.

render

(
  • elapsed
  • [force=false]
)

Inherited from springroll.AbstractDisplay but overwritten in render:169

Updates the stage and draws it. This is only called by the Application. This method does nothing if paused is true or visible is false.

Parameters:

  • elapsed Int

    The time elapsed since the previous frame.

  • [force=false] Boolean optional

    Will re-render even if the game is paused or not visible

resize

(
  • width
  • height
)
Resizes the canvas. This is only called by the Application.

Parameters:

  • width Int
    The width that the display should be
  • height Int
    The height that the display should be

trigger

(
  • type
  • arguments
)

Dispatch an event

Parameters:

  • type String

    The type of event to trigger

  • arguments

    Additional parameters for the listener functions.

type

(
  • value
)
String
private

Return type of the value.

Parameters:

  • value

Returns:

String:

The type

_autoPreventDefault

Boolean private

If preventDefault() should be called on all touch events and mousedown events. Defaults to true.

_destroyed

Boolean protected

If the dispatcher is destroyed

_enabled

Boolean private
If input is enabled on the stage.

_listeners

Object private

The collection of listeners

_visible

Boolean private
If the display is visible.

adapter

DisplayAdapter public
Some of the modules require a special display adapter to provide common methods for managing display objects.

Default: null

animator

springroll.Animator deprecated

Defined in animator:15

Deprecated: since version 0.4.0

See animator

autoPreventDefault

Boolean public

If preventDefault() should be called on all touch events and mousedown events. Defaults to true.

canvas

DOMElement public
the canvas managed by this display

DELTA_HELPER

Unknown private static

Defined in DELTA_HELPER:91

An internal helper to avoid creating an object each render while telling EaselJS the amount of time elapsed.

destroyed

Boolean

If the dispatcher is destroyed

enabled

Boolean public

Inherited from springroll.AbstractDisplay but overwritten in enabled:102

If input is enabled on the stage for this display. The default is true.

height

Int public
Convenience method for getting the height of the canvas element would be the same thing as canvas.height

id

String public
The DOM id for the canvas

keepMouseover

Boolean public

Defined in keepMouseover:51

If the display should keep mouse move events running when the display is disabled.

mouseOverRate

Int public

Defined in mouseOverRate:43

The rate at which EaselJS calculates mouseover events, in times/second.

Default: 30

paused

Boolean public
If rendering is paused on this display only. Pausing all displays can be done using Application.paused setter.

stage

createjs.Stage | createjs.SpriteStage public

Inherited from springroll.AbstractDisplay but overwritten in stage:74

The rendering library's stage element, the root display object

visible

Boolean public
If the display is visible, using "display: none" css on the canvas. Invisible displays won't render.

width

Int public
Convenience method for getting the width of the canvas element would be the same thing as canvas.width

disabled

If the display becomes disabled

enable

Enabled state changed on the display

Event Payload:

  • enabled Boolean
    Current state of enabled

enabled

If the display becomes enabled

hidden

If the display becomes hidden

visibility

Visibility changed on the display

Event Payload:

  • visible Boolean
    Current state of the visibility

visible

If the display becomes visible