#

API Docs for: 1.6.0
Show: Inherited Protected Private Deprecated

# ImageLoader Class

Uses

- EventTarget

Defined in: `src/pixi/loaders/ImageLoader.js:5`
Module: PIXI

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`

)

Defined in `src/pixi/loaders/ImageLoader.js:5`

#### Parameters:

- `url` String

  The url of the image

- `crossorigin` Boolean

  Whether requests should be treated as crossorigin

- Index
- Methods
- Properties

## Item Index

### Methods

- addEventListener
- dispatchEvent
- load
- loadFramedSpriteSheet
- onLoaded
- removeAllEventListeners
- removeEventListener

### Properties

- listeners
- texture

## Methods

### `addEventListener`

(

- `type`
- `listener`

)

Inherited from EventTarget: `src/pixi/utils/EventTarget.js:32`

Adds a listener for a specific event

#### Parameters:

- `type` String

  A string representing the event type to listen for.

- `listener` Function

  The callback function that will be fired when the event occurs

### `dispatchEvent`

(

- `event`

)

Inherited from EventTarget: `src/pixi/utils/EventTarget.js:55`

Fires the event, ie pretends that the event has happened

#### Parameters:

- `event` Event

  the event object

### `load`

()

Defined in `src/pixi/loaders/ImageLoader.js:39`

Loads image or takes it from cache

### `loadFramedSpriteSheet`

(

- `frameWidth`
- `frameHeight`
- `textureName`

)

Defined in `src/pixi/loaders/ImageLoader.js:71`

Loads image and split it to uniform sized frames

#### Parameters:

- `frameWidth` Number

  width of each frame

- `frameHeight` Number

  height of each frame

- `textureName` String

  if given, the frames will be cached in - format

### `onLoaded`

() private

Defined in `src/pixi/loaders/ImageLoader.js:60`

Invoked when image file is loaded or it is already cached and ready to use

### `removeAllEventListeners`

(

- `type`

)

Inherited from EventTarget: `src/pixi/utils/EventTarget.js:101`

Removes all the listeners that were active for the specified event type

#### Parameters:

- `type` String

  A string representing the event type which will have all its listeners removed

### `removeEventListener`

(

- `type`
- `listener`

)

Inherited from EventTarget: `src/pixi/utils/EventTarget.js:80`

Removes the specified listener that was assigned to the specified event type

#### Parameters:

- `type` String

  A string representing the event type which will have its listener removed

- `listener` Function

  The callback function that was be fired when the event occured

## Properties

### `listeners`

Object

Inherited from EventTarget: `src/pixi/utils/EventTarget.js:24`

Holds all the listeners

### `texture`

Texture

Defined in `src/pixi/loaders/ImageLoader.js:20`

The texture being loaded