You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/loader/Loader.js
+26-11Lines changed: 26 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@
8
8
/**
9
9
* The Loader handles loading all external content such as Images, Sounds, Texture Atlases and data files.
10
10
* It uses a combination of Image() loading and xhr and provides progress and completion callbacks.
11
-
*
11
+
*
12
12
* @class Phaser.Loader
13
13
* @constructor
14
14
* @param {Phaser.Game} game - A reference to the currently running game.
@@ -48,7 +48,7 @@ Phaser.Loader = function (game) {
48
48
* You can optionally link a sprite to the preloader.
49
49
* If you do so the Sprites width or height will be cropped based on the percentage loaded.
50
50
* This property is an object containing: sprite, rect, direction, width and height
51
-
*
51
+
*
52
52
* @property {object} preloadSprite
53
53
*/
54
54
this.preloadSprite=null;
@@ -94,10 +94,10 @@ Phaser.Loader = function (game) {
94
94
this.onLoadComplete=newPhaser.Signal();
95
95
96
96
/**
97
-
* @property {Phaser.Signal} onPackComplete - This event is dispatched when an asset pack has either loaded or failed.
97
+
* @property {Phaser.Signal} onPackComplete - This event is dispatched when an asset pack has either loaded or failed.
98
98
*/
99
99
this.onPackComplete=newPhaser.Signal();
100
-
100
+
101
101
/**
102
102
* @property {boolean} useXDomainRequest - If true and if the browser supports XDomainRequest, it will be used in preference for xhr when loading json files. It is enabled automatically if the browser is IE9, but you can disable it as required.
103
103
*/
@@ -215,7 +215,7 @@ Phaser.Loader.prototype = {
215
215
/**
216
216
* Check whether asset exists with a specific key.
217
217
* Use Phaser.Cache to access loaded assets, e.g. Phaser.Cache#checkImageKey
218
-
*
218
+
*
219
219
* @method Phaser.Loader#checkKeyExists
220
220
* @param {string} type - The type asset you want to check.
221
221
* @param {string} key - Key of the asset you want to check.
@@ -614,6 +614,21 @@ Phaser.Loader.prototype = {
614
614
615
615
},
616
616
617
+
/**
618
+
* Add a new audiosprite file to the loader.
619
+
*
620
+
* @method Phaser.Loader#audiosprite
621
+
* @param {string} key - Unique asset key of the audio file.
622
+
* @param {Array|string} urls - An array containing the URLs of the audio files, i.e.: [ 'audiosprite.mp3', 'audiosprite.ogg', 'audiosprite.m4a' ] or a single string containing just one URL.
623
+
* @param {string} atlasurl - the url containing the audiosprite configuration json
624
+
* @return {Phaser.Loader} This Loader instance.
625
+
*/
626
+
audiosprite: function(key,urls,atlasurl){
627
+
this.audio(key,urls);
628
+
this.json(key+'-audioatlas',atlasurl);
629
+
returnthis;
630
+
},
631
+
617
632
/**
618
633
* Add a new tilemap loading request.
619
634
*
@@ -1000,7 +1015,7 @@ Phaser.Loader.prototype = {
1000
1015
console.warn('Phaser.Loader loadPackList invalid index '+this._packIndex);
1001
1016
return;
1002
1017
}
1003
-
1018
+
1004
1019
varpack=this._packList[this._packIndex];
1005
1020
1006
1021
if(pack.data!==null)
@@ -1179,7 +1194,7 @@ Phaser.Loader.prototype = {
1179
1194
console.warn('Phaser.Loader loadFile invalid index '+this._fileIndex);
* @param {string} [marker] - The name of sound to play
45
+
* @param {number} [volume=1] - Volume of the sound you want to play. If none is given it will use the volume given to the Sound when it was created (which defaults to 1 if none was specified).
0 commit comments