Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Elliot Stokes committed Jan 12, 2014
1 parent 22b7a3f commit be6eeed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ Yet another JavaScript preloader. Used to preload media to ensure it has loaded

To use first you need an array of items to preload

```javascript
var items = [
{ identifier: "enemyImage", type:"image", src: "images/house.jpeg"},
{ identifier: "backgroudSound",type:"audio", src: "sounds/background.mp3"},
{ identifier: "bangSound",type:"audio", src: "sounds/bang.mp3"},
{ identifier: "explosionSound",type:"audio", src: "sounds/explosion.mp3"},
{ identifier: "laserSound",type:"audio", src: "sounds/laser.mp3"}
];
```

pass these into the constructor

```javascript
var preloader = new Preloader(items);

preloader.preloadComplete = function() {
Expand All @@ -28,8 +31,10 @@ preloader.progressChanged = function(percentComplete) {
};

preloader.preload();

```
Once the preload complete event has fired you can access the loaded objcts with

```javascript
var sound = _PreLoader.getItem("id");
sound.play();
```

0 comments on commit be6eeed

Please sign in to comment.