Skip to content

Commit a6116b3

Browse files
committed
Loader - fixes
- `onLoadComplete` will fire, even when loading is interrupted - Context default to `this` on application.
1 parent 9995edb commit a6116b3

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/loader/Loader.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ Phaser.Loader.prototype = {
466466

467467
if (typeof url === 'undefined') { url = null; }
468468
if (typeof data === 'undefined') { data = null; }
469-
if (typeof callbackContext === 'undefined') { callbackContext = this; }
469+
if (typeof callbackContext === 'undefined') { callbackContext = null; }
470470

471471
if (!url && !data)
472472
{
@@ -1037,6 +1037,10 @@ Phaser.Loader.prototype = {
10371037
if (!this.isLoading)
10381038
{
10391039
console.warn('Phaser.Loader - active loading cancelled/reset');
1040+
if (!this.hasLoaded)
1041+
{
1042+
this.onLoadComplete.dispatch();
1043+
}
10401044
this.reset();
10411045
return;
10421046
}
@@ -1052,7 +1056,8 @@ Phaser.Loader.prototype = {
10521056
i--;
10531057

10541058
file.loading = false;
1055-
file.requestObject = null; // clear XHR or other
1059+
file.requestUrl = null;
1060+
file.requestObject = null;
10561061

10571062
if (file.error)
10581063
{
@@ -1258,11 +1263,11 @@ Phaser.Loader.prototype = {
12581263
break;
12591264

12601265
case "script":
1261-
this.script(file.key, file.url, file.callback, pack.callbackContext);
1266+
this.script(file.key, file.url, file.callback, pack.callbackContext || this);
12621267
break;
12631268

12641269
case "binary":
1265-
this.binary(file.key, file.url, file.callback, pack.callbackContext);
1270+
this.binary(file.key, file.url, file.callback, pack.callbackContext || this);
12661271
break;
12671272

12681273
case "spritesheet":
@@ -1719,7 +1724,7 @@ Phaser.Loader.prototype = {
17191724

17201725
case 'bitmapfont':
17211726

1722-
if (file.xmlURL == null)
1727+
if (!file.xmlURL)
17231728
{
17241729
this.game.cache.addBitmapFont(file.key, file.url, file.data, file.xmlData, file.xSpacing, file.ySpacing);
17251730
}

0 commit comments

Comments
 (0)