Class createjs.LoadQueue
Extends
.
Defined in: load_queue.js.
Constructor Attributes | Constructor Name and Description |
---|---|
createjs.LoadQueue(opt_useXHR, opt_basePath, opt_crossOrigin)
A class that downloads resources.
|
Method Attributes | Method Name and Description |
---|---|
close()
Closes the active queue.
|
|
getItem(value)
Retrieves a preload item provided by applications from an ID or a source.
|
|
getResult(value, opt_rawResult)
Retrieves a loaded result with either an ID or a source.
|
|
handleFileComplete(loader)
|
|
handleFileError(loader, type, message)
|
|
installPlugin(plugin)
Registers a plug-in.
|
|
<static> |
createjs.LoadQueue.Listener()
An interface that observes activities of a LoadQueue object.
|
load()
Starts loading files added to this queue.
|
|
loadFile(file, opt_loadNow, opt_basePath)
Loads a single file.
|
|
loadManifest(manifest, opt_loadNow, opt_basePath)
Loads an array of files.
|
|
remove(var_args)
Removes an item from the loading queue.
|
|
Stops all queued and loading items, and clears the queue.
|
|
reset()
Resets this loader.
|
|
setMaxConnections(value)
Sets the maximum number of concurrent connections.
|
|
setPaused(value)
Pauses loading items or resumes it.
|
|
setUseXHR(useXHR)
Changes whether to use XMLHttpRequest objects to load files.
|
Class Detail
createjs.LoadQueue(opt_useXHR, opt_basePath, opt_crossOrigin)
A class that downloads resources. This class automatically chooses the best
method and sends cross-origin requests, i.e. this class ignores the
'opt_useXHR' parameter and the 'opt_crossOrigin' one.
- Parameters:
- {boolean=} opt_useXHR
- {string=} opt_basePath
- {string|boolean=} opt_crossOrigin
Method Detail
close()
Closes the active queue.
{Object}
getItem(value)
Retrieves a preload item provided by applications from an ID or a source.
- Parameters:
- {string} value
- Returns:
- {Object}
{*}
getResult(value, opt_rawResult)
Retrieves a loaded result with either an ID or a source. This method returns
the content if it has been loaded.
* An HTMLImageElement object for image files.
* An HTMLAudioElement object for audio files. (This method returns null if
the createjs.Sound class uses the WebAudio API.)
* An HTMLScriptElement object for JavaScript files.
* An HTMLStyleElement object for CSS files.
* A string primitive for TEXT files.
* A JavaScript object for JSON files.
- Parameters:
- {string} value
- {boolean=} opt_rawResult
- Returns:
- {*}
handleFileComplete(loader)
- Parameters:
- loader
handleFileError(loader, type, message)
- Parameters:
- loader
- type
- message
installPlugin(plugin)
Registers a plug-in.
- Parameters:
- {Object} plugin
<static>
createjs.LoadQueue.Listener()
An interface that observes activities of a LoadQueue object.
load()
Starts loading files added to this queue.
loadFile(file, opt_loadNow, opt_basePath)
Loads a single file.
- Parameters:
- {Object | string} file
- The file object or path to load. A file can be either:
1. A string path to a resource, or;
2. An object that contains:
-
* src
The source of the file that is being loaded. This property is required.
The source can either be a string (recommended), or an HTML tag.
* type
The type of file that will be loaded (image, sound, json, etc).
PreloadJS does auto-detection of types using the extension. Supported
types are defined on LoadQueue, such as LoadQueue.IMAGE. It is
recommended that a type is specified when a non-standard file URI (such
as a PHP script) us used.
* id
A string identifier which can be used to reference the loaded object.
* callback (optional)
used for JSONP requests, to define what method to call when the JSONP
is loaded.
* data
An arbitrary data object, which is included with the loaded object.
* method
used to define if this request uses GET or POST when sending data to
the server. The default value is "GET".
* values (optional)
An object of name/value pairs to send to the server.
* headers (optional)
An object hash of headers to attach to an XHR request.
- {boolean=} opt_loadNow
- {string=} opt_basePath
loadManifest(manifest, opt_loadNow, opt_basePath)
Loads an array of files.
- Parameters:
- {Array|string|Object} manifest
- An list of files to load. The loadManifest call supports four types of manifests: 1. A string path, which points to a manifest file, which is a JSON file that contains a manifest property, which defines the list of files to load, and can optionally contain a path property, which will be prepended to each file in the list. 2. An array of files to load. 3. An object which defines a src property, which is a JSON or JSONP file. A callback property can be defined for JSONP file. The JSON/JSONP file should contain a manifest property, which defines the list of files to load, and can optionally contain a "path" property, which will be prepended to each file in the list. 4. An object which contains a manifest property, which defines the list of files to load, and can optionally contain a path property, which will be prepended to each file in the list. See the loadFile() method for description about a file.
- {boolean=} opt_loadNow
- {string=} opt_basePath
remove(var_args)
Removes an item from the loading queue. This method sops an item from being
loaded, and removes it from the queue. If nothing is passed, all items are
removed. This also removes internal references to loaded item(s).
Example
queue.loadManifest([
{ 'src': 'test.png', 'id': 'png' },
{ 'src': 'test.jpg', 'id': 'jpg' },
{ 'src': 'test.mp3', 'id': 'mp3' }
]);
queue.remove('png'); // Single item by ID
queue.remove('png', 'test.jpg'); // Items as arguments. Mixed id and src.
queue.remove(['test.png', 'jpg']); // Items in an Array. Mixed id and src.
- Parameters:
-
{...(string|Array.
)} var_args
removeAll()
Stops all queued and loading items, and clears the queue.
reset()
Resets this loader. This method stops all open loads, destroys any loaded
items, and reloads all items in the queue.
setMaxConnections(value)
Sets the maximum number of concurrent connections.
- Parameters:
- {number} value
setPaused(value)
Pauses loading items or resumes it.
- Parameters:
- {boolean} value
{boolean}
setUseXHR(useXHR)
Changes whether to use XMLHttpRequest objects to load files. (The
createjs.Loader class uses XMLHttpRequest v2 whenever possible and it ignores
this setting.)
- Parameters:
- {boolean} useXHR
- Returns:
- {boolean}