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
* You can set a Sprite to be a "preload" sprite by passing it to this method.
235
+
* Set a Sprite to be a "preload" sprite by passing it to this method.
236
+
*
236
237
* A "preload" sprite will have its width or height crop adjusted based on the percentage of the loader in real-time.
237
-
* This allows you to easily make loading bars for games. Note that Sprite.visible = true will be set when calling this.
238
+
* This allows you to easily make loading bars for games.
239
+
*
240
+
* The sprite will automatically be made visible when calling this.
238
241
*
239
242
* @method Phaser.Loader#setPreloadSprite
240
243
* @param {Phaser.Sprite|Phaser.Image} sprite - The sprite or image that will be cropped during the load.
@@ -265,9 +268,11 @@ Phaser.Loader.prototype = {
265
268
266
269
/**
267
270
* Called automatically by ScaleManager when the game resizes in RESIZE scalemode.
271
+
*
268
272
* We use this to adjust the height of the preloading sprite, if set.
269
273
*
270
274
* @method Phaser.Loader#resize
275
+
* @protected
271
276
*/
272
277
resize: function(){
273
278
@@ -279,8 +284,9 @@ Phaser.Loader.prototype = {
279
284
},
280
285
281
286
/**
282
-
* Check whether asset exists with a specific key.
283
-
* Use Phaser.Cache to access loaded assets, e.g. Phaser.Cache#checkImageKey
287
+
* Check whether a file/asset with a specific key is queued to be loaded.
288
+
*
289
+
* To access a loaded asset use Phaser.Cache, eg. {@link Phaser.Cache#checkImageKey}
284
290
*
285
291
* @method Phaser.Loader#checkKeyExists
286
292
* @param {string} type - The type asset you want to check.
@@ -294,12 +300,15 @@ Phaser.Loader.prototype = {
294
300
},
295
301
296
302
/**
297
-
* Gets the fileList index for the given key.
303
+
* Get the queue-index of the file/asset with a specific key.
304
+
*
305
+
* Only assets in the download file queue will be found.
298
306
*
299
307
* @method Phaser.Loader#getAssetIndex
300
308
* @param {string} type - The type asset you want to check.
301
309
* @param {string} key - Key of the asset you want to check.
302
310
* @return {number} The index of this key in the filelist, or -1 if not found.
311
+
* The index may change and should only be used immediately following this call
303
312
*/
304
313
getAssetIndex: function(type,key){
305
314
@@ -316,12 +325,14 @@ Phaser.Loader.prototype = {
316
325
},
317
326
318
327
/**
319
-
* Gets the asset that is queued for load.
328
+
* Find a file/asset with a specific key.
329
+
*
330
+
* Only assets in the download file queue will be found.
320
331
*
321
332
* @method Phaser.Loader#getAsset
322
333
* @param {string} type - The type asset you want to check.
323
334
* @param {string} key - Key of the asset you want to check.
324
-
* @return {any} Returns an object if found that has 2 properties: index and asset entry. Otherwise false.
335
+
* @return {any} Returns an object if found that has 2 properties: `index` and `file`; otherwise a non-true value is returned.
325
336
* The index may change and should only be used immediately following this call.
326
337
*/
327
338
getAsset: function(type,key){
@@ -448,7 +459,7 @@ Phaser.Loader.prototype = {
448
459
* @param {string} key - Unique asset key of this resource pack.
449
460
* @param {string} [url] - URL of the Asset Pack JSON file. If you wish to pass a json object instead set this to null and pass the object as the data parameter.
450
461
* @param {object} [data] - The Asset Pack JSON data. Use this to pass in a json data object rather than loading it from a URL. TODO
451
-
* @param {object} [callbackContext] - Some Loader operations, like Binary and Script require a context for their callbacks. Pass the context here.
462
+
* @param {object} [callbackContext=(loader)] - Some Loader operations, like Binary and Script require a context for their callbacks. Pass the context here.
452
463
* @return {Phaser.Loader} This Loader instance.
453
464
*/
454
465
pack: function(key,url,data,callbackContext){
@@ -593,7 +604,7 @@ Phaser.Loader.prototype = {
593
604
* @param {string} key - Unique asset key of the script file.
594
605
* @param {string} url - URL of the JavaScript file.
595
606
* @param {function} [callback=(none)] - Optional callback that will be called after the script tag has loaded, so you can perform additional processing.
596
-
* @param {object} [callbackContext=(Loader)] - The context under which the callback will be applied. If not specified it will use the callback itself as the context.
607
+
* @param {object} [callbackContext=(loader)] - The context under which the callback will be applied. If not specified it will use the callback itself as the context.
* Audio Sprites are a combination of audio files and a JSON configuration.
687
-
* The JSON follows the format of that created by https://github.com/tonistiigi/audiosprite
688
-
*
689
-
* @method Phaser.Loader#audiosprite
690
-
* @param {string} key - Unique asset key of the audio file.
691
-
* @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.
692
-
* @param {string} atlasURL - The URL of the audiosprite configuration json.
693
-
* @return {Phaser.Loader} This Loader instance.
694
-
*/
695
+
* Add a new audiosprite file to the loader.
696
+
*
697
+
* Audio Sprites are a combination of audio files and a JSON configuration.
698
+
* The JSON follows the format of that created by https://github.com/tonistiigi/audiosprite
699
+
*
700
+
* @method Phaser.Loader#audiosprite
701
+
* @param {string} key - Unique asset key of the audio file.
702
+
* @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.
703
+
* @param {string} atlasURL - The URL of the audiosprite configuration json.
704
+
* @return {Phaser.Loader} This Loader instance.
705
+
*/
695
706
audiosprite: function(key,urls,atlasURL){
696
707
697
708
this.audio(key,urls);
@@ -952,7 +963,9 @@ Phaser.Loader.prototype = {
952
963
},
953
964
954
965
/**
955
-
* Remove loading request of a file; does nothing if the file is already processed.
966
+
* Remove a file/asset from the loading queue.
967
+
*
968
+
* A file that has already started loading cannot be removed.
956
969
*
957
970
* @method Phaser.Loader#removeFile
958
971
* @protected
@@ -973,7 +986,7 @@ Phaser.Loader.prototype = {
973
986
},
974
987
975
988
/**
976
-
* Remove all file loading requests - this is _insufficient_ to clear loading. Use `reset` instead.
989
+
* Remove all file loading requests - this is _insufficient_ to stop current loading. Use `reset` instead.
0 commit comments