From a2d145a43d8befc1f1cce8ec757db941978a3f2a Mon Sep 17 00:00:00 2001 From: photonstorm Date: Mon, 18 Apr 2016 16:44:28 +0100 Subject: [PATCH] When the Loader loads audio via the Audio tag, instead of Web Audio, it used to use `Phaser.GAMES[_this.game.id].load` as the callback handler, which would stop it from working if you had multiple Loaders set-up within Phaser. It now uses a local reference to `_this` instead (thanks @SBCGames #2435) --- README.md | 1 + src/Phaser.js | 2 +- src/loader/Loader.js | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 03c2ab98d..bdc6e583a 100644 --- a/README.md +++ b/README.md @@ -378,6 +378,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/ * Emitter.start when used with a false `explode` parameter would cumulatively add particles to the current total. With quantity 10 the first call would emit 10 particles, the next 20, and so on. Calls to start will now reset the quantity each time. This is a behavior change from earlier versions, so if you relied on the old way please account for it in your code (thanks @BdR76 #2187) * You can now pass in your own Canvas element to Phaser and it will use that instead of creating one itself. To do so you must pass a Game Configuration object to Phaser when you instantiate it, and set the `canvas` property of the config object to be the DOM element you wish to use, i.e.: `{ canvas: document.getElementById('yourCanvas') }` (thanks @Friksel #2311) * When loading Video with the `asBlob` argument set it now uses a 'blob' type for the XHR loader, and doesn't cast the resulting file as a Blob upon load. This fixes loading videos as blobs on Chrome for Android (thanks @JuCarr #2433) +* When the Loader loads audio via the Audio tag, instead of Web Audio, it used to use `Phaser.GAMES[_this.game.id].load` as the callback handler, which would stop it from working if you had multiple Loaders set-up within Phaser. It now uses a local reference to `_this` instead (thanks @SBCGames #2435) ### Bug Fixes diff --git a/src/Phaser.js b/src/Phaser.js index d3b588c72..4bade6e80 100644 --- a/src/Phaser.js +++ b/src/Phaser.js @@ -15,7 +15,7 @@ var Phaser = Phaser || { * @constant * @type {string} */ - VERSION: '2.4.7 RC1', + VERSION: '2.4.7 RC2', /** * An array of Phaser game instances. diff --git a/src/loader/Loader.js b/src/loader/Loader.js index 0115e2ead..d0bf7e02e 100644 --- a/src/loader/Loader.js +++ b/src/loader/Loader.js @@ -2276,9 +2276,9 @@ Phaser.Loader.prototype = { var playThroughEvent = function () { file.data.removeEventListener('canplaythrough', playThroughEvent, false); file.data.onerror = null; - // Why does this cycle through games? - Phaser.GAMES[_this.game.id].load.fileComplete(file); + _this.fileComplete(file); }; + file.data.onerror = function () { file.data.removeEventListener('canplaythrough', playThroughEvent, false); file.data.onerror = null;