API Documentation for: 1.1.23
Show:

MediaLoader Class

Defined in: MediaLoader:8
Namespace: cloudkid

The Medialoader is the singleton loader for loading all assets including images, data, code and sounds. MediaLoader supports cache-busting in the browser using dynamic query string parameters.

Methods

_initialize

() protected

Defined in _initialize:152

Initilize the object

_loadDone

(
  • qi
  • result
)
private

Defined in _loadDone:308

Alert that the loading is finished

Parameters:

  • qi cloudkid.LoaderQueueItem

    The loader queue item

  • result Object

    The event from preloadjs or null

_onLoadCompleted

(
  • qi
  • ev
)
private

The file was loaded successfully

Parameters:

  • qi cloudkid.LoaderQueueItem

    The loader queue item

  • ev Object

    The load event

_onLoadFailed

(
  • qi
)
private

Defined in _onLoadFailed:206

There was an error loading the file

Parameters:

  • qi cloudkid.LoaderQueueItem

    The loader queue item

_onLoadProgress

(
  • qi
  • event
)
private

Defined in _onLoadProgress:238

The file load progress event

Parameters:

  • qi cloudkid.LoaderQueueItem

    The loader queue item

  • event Object

    The progress event

_tryNextLoad

() private

Defined in _tryNextLoad:276

Attempt to do the next load

cancel

(
  • url
)
Bool public

Defined in cancel:326

Cancel a load that's currently in progress

Parameters:

Returns:

Bool:

If canceled returns true, false if not canceled

destroy

() public

Defined in destroy:115

Destroy the MediaLoader singleton, don't use after this

init

() public static

Defined in init:81

Static constructor creating the singleton

load

(
  • url
  • callback
  • updateCallback
  • priority
  • data
)
public

Defined in load:169

Load a file

Parameters:

  • url String

    The file path to load

  • callback Function

    The callback function when completed

  • updateCallback Function*

    The callback for load progress update, passes 0-1 as param

  • priority Int

    The priority of the load

  • data

    optional data

Properties

cacheManager

cloudkid.CacheManager public

Defined in cacheManager:74

The reference to the cache manager

instance

cloudkid.OS public static

Defined in instance:97

Static function for getting the singleton instance

loaders

Object private

Defined in loaders:39

The collection of loaders

maxSimultaneousLoads

Int public

The maximum number of simulaneous loads

Default: 2

numLoads

Int private

Defined in numLoads:50

The current number of items loading

Default: 0