Added OnFileStart signal to loader

We've had a number of people in the channel ask for the ability to know when a file has started loading and to get the file names of said files.

Added the OnFileStart signal to do just that.
This commit is contained in:
jdowell 2014-04-11 13:17:26 -05:00
parent c1ff6ef0df
commit c9a67936d8

View file

@ -94,6 +94,12 @@ Phaser.Loader = function (game) {
*/
this.baseURL = '';
/**
* @property {Phaser.Signal} onFileStart - Event signal.
*/
this.onFileStart = new Phaser.Signal();
/**
* @property {Phaser.Signal} onFileComplete - Event signal.
*/
@ -879,6 +885,8 @@ Phaser.Loader.prototype = {
console.warn('Phaser.Loader loadFile invalid index ' + this._fileIndex);
return;
}
this.onFileStart.dispatch(this.progress, this._fileList[this._fileIndex]);
var file = this._fileList[this._fileIndex];
var _this = this;