ImageLoader Class
The image loader class is responsible for loading images file formats ('jpeg', 'jpg', 'png' and 'gif') Once the image has been loaded it is stored in the PIXI texture cache and can be accessed though PIXI.Texture.fromFrameId() and PIXI.Sprite.fromFrameId() When loaded this class will dispatch a 'loaded' event
Constructor
ImageLoader
-
url
-
crossorigin
Parameters:
-
url
StringThe url of the image
-
crossorigin
BooleanWhether requests should be treated as crossorigin
Item Index
Methods
Methods
addEventListener
-
type
-
listener
Adds a listener for a specific event
Parameters:
-
type
StringA string representing the event type to listen for.
-
listener
FunctionThe callback function that will be fired when the event occurs
dispatchEvent
-
event
Fires the event, ie pretends that the event has happened
Parameters:
-
event
Eventthe event object
load
()
Loads image or takes it from cache
loadFramedSpriteSheet
-
frameWidth
-
frameHeight
-
textureName
Loads image and split it to uniform sized frames
Parameters:
-
frameWidth
Numberwidth of each frame
-
frameHeight
Numberheight of each frame
-
textureName
Stringif given, the frames will be cached in
- format
onLoaded
()
private
Invoked when image file is loaded or it is already cached and ready to use
removeAllEventListeners
-
type
Removes all the listeners that were active for the specified event type
Parameters:
-
type
StringA string representing the event type which will have all its listeners removed
removeEventListener
-
type
-
listener
Removes the specified listener that was assigned to the specified event type
Parameters:
-
type
StringA string representing the event type which will have its listener removed
-
listener
FunctionThe callback function that was be fired when the event occured