Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name |
string |
The name of the resource to load. |
||
url |
string | Array<string> |
The url for this resource, for audio/video loads you can pass an array of sources. |
||
options |
object |
<optional> |
The options for the load. |
|
options.crossOrigin |
string | boolean |
<optional> |
Is this request cross-origin? Default is to determine automatically. |
|
options.timeout |
number |
<optional> |
0 |
A timeout in milliseconds for the load. If the load takes
longer than this time it is cancelled and the load is considered a failure. If this value is
set to |
options.loadType |
PIXI.LoaderResource.LOAD_TYPE |
<optional> |
LOAD_TYPE.XHR |
How should this resource be loaded? |
options.xhrType |
PIXI.LoaderResource.XHR_RESPONSE_TYPE |
<optional> |
XHR_RESPONSE_TYPE.DEFAULT |
How should the data being loaded be interpreted when using XHR? |
options.metadata |
PIXI.LoaderResource.IMetadata |
<optional> |
Extra configuration for middleware and the Resource object. |
Members
used by parsing middleware
children Array<PIXI.LoaderResource> readonly
The child resources this resource owns.
Is this request cross-origin? If unset, determined automatically.
The data that was loaded by the resource.
The error that occurred while loading (if any).
The extension used to load this resource.
Describes if this resource has finished loading. Is true when the resource has completely loaded.
Stores whether or not this url is a data url.
Describes if this resource is currently loading. Is true when the resource starts loading, and is false again when complete.
loadType PIXI.LoaderResource.LOAD_TYPE
The method of loading to use for this resource.
metadata PIXI.IResourceMetadata
Extra info for middleware, and controlling specifics about how the resource loads.
Note that if you pass in a loadElement
, the Resource class takes ownership of it.
Meaning it will modify it as it sees fit.
The name of this resource.
onAfterMiddleware PIXI.Signal
Dispatched after this resource has had all the after middleware run on it.
The callback looks like LoaderResource.OnCompleteSignal.
onComplete PIXI.Signal
Dispatched once this resource has loaded, if there was an error it will
be in the error
property.
The callback looks like LoaderResource.OnCompleteSignal.
onProgress PIXI.Signal
Dispatched each time progress of this resource load updates. Not all resources types and loader systems can support this event so sometimes it may not be available. If the resource is being loaded on a modern browser, using XHR, and the remote server properly sets Content-Length headers, then this will be available.
The callback looks like LoaderResource.OnProgressSignal.
onStart PIXI.Signal
Dispatched when the resource beings to load.
The callback looks like LoaderResource.OnStartSignal.
The progress chunk owned by this resource.
spritesheet PIXI.Spritesheet
Reference to Spritesheet object created.
texture PIXI.Texture
Texture reference for loading images and other textures.
textures Object<string, PIXI.Texture>
Dictionary of textures from Spritesheet.
A timeout in milliseconds for the load. If the load takes longer than this time
it is cancelled and the load is considered a failure. If this value is set to 0
then there is no explicit timeout.
type PIXI.LoaderResource.TYPE readonly
The resource type.
The url used to load this resource.
The XHR object that was used to load this resource. This is only set
when loadType
is LoaderResource.LOAD_TYPE.XHR
.
The type used to load the resource via XHR. If unset, determined automatically.
Enums
PIXI.LoaderResource.LOAD_TYPEnumber
The types of loading a resource can use.
Properties:
Name | Description |
---|---|
AUDIO |
Uses an |
IMAGE |
Uses an |
VIDEO |
Uses a |
XHR |
Uses XMLHttpRequest to load the resource. |
PIXI.LoaderResource.STATUS_FLAGSnumber
The types of resources a resource could represent.
Properties:
Name | Description |
---|---|
COMPLETE |
Complete |
DATA_URL |
Data URL |
LOADING |
Loading |
NONE |
None |
PIXI.LoaderResource.TYPEnumber
The types of resources a resource could represent.
Properties:
Name | Description |
---|---|
AUDIO |
Audio |
IMAGE |
Image |
JSON |
JSON |
TEXT |
Plain text |
UNKNOWN |
Unknown |
VIDEO |
Video |
XML |
XML |
PIXI.LoaderResource.XHR_RESPONSE_TYPEstring
The XHR ready states, used internally.
Properties:
Name | Description |
---|---|
BLOB |
Blob |
BUFFER |
ArrayBuffer |
DEFAULT |
string |
DOCUMENT |
Document |
JSON |
Object |
TEXT |
String |
Type Definitions
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
loadElement |
HTMLImageElement | HTMLAudioElement | HTMLVideoElement |
<optional> |
null |
The element to use for loading, instead of creating one. |
mimeType |
string | Array<string> |
<optional> |
The mime type to use for the source element of a video/audio elment. If the urls are an array, you can pass this as an array as well where each index is the mime type to use for the corresponding url index. |
|
skipSource |
boolean |
<optional> |
false |
Skips adding source(s) to the load element. This
is useful if you want to pass in a |
Methods
Sets the load type to be used for a specific extension.
Name | Type | Description |
---|---|---|
extname |
string |
The extension to set the type for, e.g. "png" or "fnt" |
loadType |
PIXI.LoaderResource.LOAD_TYPE |
The load type to set it to. |
Sets the load type to be used for a specific extension.
Name | Type | Description |
---|---|---|
extname |
string |
The extension to set the type for, e.g. "png" or "fnt" |
xhrType |
PIXI.LoaderResource.XHR_RESPONSE_TYPE |
The xhr type to set it to. |
Aborts the loading of this resource, with an optional message.
Name | Type | Description |
---|---|---|
message |
string |
The message to use for the error |
Marks the resource as complete.
Kicks off loading of this resource. This method is asynchronous.
Name | Type | Attributes | Description |
---|---|---|---|
cb |
PIXI.LoaderResource.OnCompleteSignal |
<optional> |
Optional callback to call once the resource is loaded. |