#

API Docs for: 2.0.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.fromFrame() and PIXI.Sprite.fromFrame() 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

- emit
- listeners
- load
- loadFramedSpriteSheet
- mixin
- off
- on
- once
- onLoaded
- removeAllListeners

### Properties

- frames
- texture

## Methods

### `emit`

(

- `eventName`

)
Boolean

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

Emit an event to all registered event listeners.

#### Parameters:

- `eventName` String

  The name of the event.

#### Returns:

Boolean:

Indication if we've emitted an event.

### `listeners`

(

- `eventName`

)
Array

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

Return a list of assigned event listeners.

#### Parameters:

- `eventName` String

  The events that should be listed.

#### Returns:

Array:

An array of listener functions

### `load`

()

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

Loads image or takes it from cache

### `loadFramedSpriteSheet`

(

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

)

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

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

### `mixin`

(

- `object`

)

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

Mixes in the properties of the EventTarget prototype onto another object

#### Parameters:

- `object` Object

  The obj to mix into

### `off`

(

- `eventName`
- `callback`

)

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

Remove event listeners.

#### Parameters:

- `eventName` String

  The event we want to remove.

- `callback` Function

  The listener that we need to find.

### `on`

(

- `eventName`
- `callback`

)

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

Register a new EventListener for the given event.

#### Parameters:

- `eventName` String

  Name of the event.

- `callback` Functon

  fn Callback function.

### `once`

(

- `eventName`
- `callback`

)

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

Add an EventListener that's only called once.

#### Parameters:

- `eventName` String

  Name of the event.

- `callback` Function

  Callback function.

### `onLoaded`

() private

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

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

### `removeAllListeners`

(

- `eventName`

)

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

Remove all listeners or only the listeners for the specified event.

#### Parameters:

- `eventName` String

  The event you want to remove all listeners for.

## Properties

### `frames`

Array

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

if the image is loaded with loadFramedSpriteSheet frames will contain the sprite sheet frames

### `texture`

Texture

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

The texture being loaded