mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 05:03:37 +00:00
Setting event listeners directly as properties values to resolve scope issues
This commit is contained in:
parent
63e3159661
commit
6025688833
1 changed files with 4 additions and 4 deletions
|
@ -38,8 +38,8 @@ var HTML5AudioFile = new Class({
|
|||
onProgress: function (event)
|
||||
{
|
||||
var audio = event.target;
|
||||
audio.removeEventListener('canplaythrough', this.onProgress);
|
||||
audio.removeEventListener('error', this.onError);
|
||||
audio.oncanplaythrough = null;
|
||||
audio.onerror = null;
|
||||
|
||||
if(++this.filesLoaded === this.filesTotal)
|
||||
{
|
||||
|
@ -67,8 +67,8 @@ var HTML5AudioFile = new Class({
|
|||
var audio = new Audio();
|
||||
audio.name = this.key;
|
||||
audio.preload = 'auto';
|
||||
audio.addEventListener('canplaythrough', this.onProgress, false);
|
||||
audio.addEventListener('error', this.onProgress, false);
|
||||
audio.oncanplaythrough = this.onProgress.bind(this);
|
||||
audio.onerror = this.onError.bind(this);
|
||||
audio.src = GetURL(this, baseURL || '');
|
||||
audio.load();
|
||||
|
||||
|
|
Loading…
Reference in a new issue