springroll.easeljs.BaseState Class

Abstract app state class to do some preloading of assets also plays well with the app audio loading.

Constructor

springroll.easeljs.BaseState

(
  • panel
  • [options]
)

Parameters:

  • panel createjs.Container

    The panel

  • [options] Object optional

    The options

    • [next=null] String | Function optional

      The next state alias or call to next state

    • [previous=null] String | Function optional

      The previous state alias or call to previous state

    • [scaling=null] Object optional

      The scaling items to use with the ScaleManager. See ScaleManager.addItems for more information about the format of the scaling objects.

_internalCancel

()
protected
Cancel the loading of this state

_internalEnter

(
  • proceed
)
protected
Exit the state start, called by the State Manager

Parameters:

  • proceed Function
    The function to call after enter has been called

_internalEnterDone

()
private
Exit the state start, called by the State Manager

_internalEntering

(
  • proceed
)
protected
When the state is entering

Parameters:

  • proceed Function
    The function to call after enter has been called

_internalExit

()
protected
This is called by the State Manager to exit the state

_internalExitStart

()
protected
Exit the state start, called by the State Manager

_onLoaded

(
  • assets
)
private
The internal call for on assets loaded

Parameters:

  • assets Object | Null
    The assets result of the load

addTasks

(
  • tasks
)
deprecated protected

Defined in addTasks:117

Deprecated: since 0.4.0

Implementation specific for override. When you need to add additional preload tasks to your state, override this function.

Parameters:

  • tasks Array

    The list of preload tasks

destroy

()

Inherited from springroll.State: destroy:713

Don't use the state object after this

loadingDone

(
  • [delay]
)
final
Manual call to signal the end of preloading

Parameters:

  • [delay] Int optional
    Frames to delay the load completion to allow the framerate to stabilize. If not delay is set, defaults to the delayLoad property.

loadingStart

()
final
Manual call to signal the start of preloading

nextState

()
final
Goto the next state

onAssetsLoaded

()
deprecated protected

Defined in onAssetsLoaded:128

Deprecated: since 0.4.0

Implementation specific for override. When all the assets, scaling and panel setup have completed.

onProgress

(
  • progress
)
private
Handle the load progress and pass to the manager

Parameters:

  • progress Number
    The amount preloaded from zero to 1

previousState

()
final
Goto the previous state

_active

Boolean private

Inherited from springroll.State: _active:151

If the manager considers this the active panel

_canceled

Boolean private
If we canceled entering the state

_destroyed

Boolean private
If the state has been destroyed.

_enabled

Boolean private

Inherited from springroll.State: _enabled:186

If the state is enabled, meaning that it is click ready

_images

Array protected

Defined in _images:55

The global images loaded

_isLoading

Boolean private
If we are pre-loading the state

_nextState

String | Function private
Either the alias of the next state or a function to call when going to the next state.

_onEnterProceed

Function private
When we're finishing loading

_onLoadingComplete

Function private
If we start doing a load in enter, assign the onEnterComplete here

_prevState

String | Function private
Either the alias of the previous state or a function to call when going to the previous state.

active

Boolean

Inherited from springroll.State: active:448

Get if this is the active state

app

Application

Inherited from springroll.State: app:57

Reference to the main app

assets

Array | Object protected

Inherited from springroll.State: assets:137

The collection of assets loaded

assetsLoaded

Boolean deprecated

Defined in assetsLoaded:60

Deprecated: since version 0.4.0

See preloaded

cancel

Function

Inherited from springroll.State: cancel:293

Cancel the load, implementation-specific. This is where any async actions should be removed.

Default: null

canceled

Boolean

Inherited from springroll.State: canceled:435

Status of whether the panel load was canceled

config

Object

Inherited from springroll.State: config:78

Reference to the main config object

delayLoad

Int protected
The number of frames to delay the transition in after loading, to allow the framerate to stablize after heavy art instantiation.

destroyed

Boolean
If the state has been destroyed.

enabled

Boolean

Inherited from springroll.State: enabled:461

If the state is enabled, meaning that it is click ready

enter

Function

Inherited from springroll.State: enter:301

When the state is entered. Override this to start loading assets - call loadingStart() to tell the StateManager that that is going on.

Default: null

enterDone

Function
When the state is visually entered fully - after the transition is done. Override this to begin your state's activities.

Default: null

exit

Function

Inherited from springroll.State: exit:278

When the state is exited. Override this to provide state cleanup.

Default: null

exitStart

Function
When the state has requested to be exit, pre-transition. Override this to ensure that animation/audio is stopped when leaving the state.

Default: null

game

springroll.Application deprecated

Defined in game:32

Deprecated: since version 0.3.0

See springroll.BaseState/app:property

manager

springroll.StateManager

Inherited from springroll.State: manager:111

A reference to the state manager

manifest

Array deprecated

Defined in manifest:46

Deprecated: since version 0.4.0

See preload

panel

createjs.Container | PIXI.DisplayObjectContainer

Inherited from springroll.State: panel:117

The panel for the state.

preload

Array

Inherited from springroll.State: preload:123

The assets to load each time

preloaded

Boolean protected
Check to see if the assets have finished loading

scaling

springroll.ScaleManager

Inherited from springroll.State: scaling:85

Reference to the scaling object, UI module required

scalingItems

Object
The items to scale on the panel, see ScaleManager.addItems for more information. If no options are set in the State's constructor then it will try to find an object on the app config on scaling property matching the same state alias. For instance config.scaling.title if title is the state alias. If no scalingItems are set, will scale and position the panal itself.

Default: null

sound

springroll.Sound

Inherited from springroll.State: sound:71

The instance of the Sound, Sound module required

stateId

String

Inherited from springroll.State: stateId:105

The id reference

voPlayer

springroll.VOPlayer

Inherited from springroll.State: voPlayer:64

The instance of the VOPlayer, Sound module required

cancel

Inherited from springroll.State: cancel:240

Event when the loading of a state was canceled.

destroy

Inherited from springroll.State: destroy:230

Event when the state is being destroyed.

enabled

Inherited from springroll.State: enabled:269

Event when the state is enabled status changes. Enable is when the state is mouse enabled or not.

Event Payload:

  • enable Boolean
    The enabled status of the state

enterDone

Event when the transition is finished the state is fully entered.

exit

Inherited from springroll.State: exit:225

Event when the state finishes exiting. Nothing is showing at this point.

exitStart

Event when the state starts exiting, everything is showing at this point.

loaded

Inherited from springroll.State: loaded:250

Event when the preload of assets is finished. If no assets are loaded, the assets parameter is null.

Event Payload:

  • asset Object | Array | Null
    The collection of assets loaded

loading

Inherited from springroll.State: loading:262

Event when the assets are starting to load.

Event Payload:

  • asset Array
    An empty array that additional assets can be added to, if needed. Any dynamic assets that are added need to be manually unloaded when the state exits.

progress

Inherited from springroll.State: progress:256

When there has been a change in how much has been preloaded

Event Payload:

  • percentage Number
    The amount preloaded from zero to 1