Phaser.FrameData = function (){ this._frames = [] ; this._frameNames = [] ; } ; Phaser.FrameData.prototype = { addFrame: function (frame){ frame.index = _AN_Read_length('length', this._frames); this._frames.push(frame); if (frame.name !== '') { this._frameNames[frame.name] = frame.index; } return frame; } , getFrame: function (index){ if (index >= _AN_Read_length('length', this._frames)) { index = 0; } return this._frames[index]; } , getFrameByName: function (name){ if (typeof this._frameNames[name] === 'number') { return this._frames[this._frameNames[name]]; } return null ; } , checkFrameName: function (name){ if (this._frameNames[name] == null ) { return false ; } return true ; } , clone: function (){ var output = new Phaser.FrameData(); for (var i = 0; i < _AN_Read_length('length', this._frames); i++ ){ output._frames.push(this._frames[i].clone()); } for (var p in this._frameNames){ if (this._frameNames.hasOwnProperty(p)) { output._frameNames.push(this._frameNames[p]); } } return output; } , getFrameRange: function (start, end, output){ if (output === undefined) { output = [] ; } for (var i = start; i <= end; i++ ){ output.push(this._frames[i]); } return output; } , getFrames: function (frames, useNumericIndex, output){ if (useNumericIndex === undefined) { useNumericIndex = true ; } if (output === undefined) { output = [] ; } if (frames === undefined || _AN_Read_length('length', frames) === 0) { for (var i = 0; i < _AN_Read_length('length', this._frames); i++ ){ output.push(this._frames[i]); } } else { for (var i = 0; i < _AN_Read_length('length', frames); i++ ){ if (useNumericIndex) { output.push(this.getFrame(frames[i])); } else { output.push(this.getFrameByName(frames[i])); } } } return output; } , getFrameIndexes: function (frames, useNumericIndex, output){ if (useNumericIndex === undefined) { useNumericIndex = true ; } if (output === undefined) { output = [] ; } if (frames === undefined || _AN_Read_length('length', frames) === 0) { for (var i = 0; i < _AN_Read_length('length', this._frames); i++ ){ output.push(this._frames[i].index); } } else { for (var i = 0; i < _AN_Read_length('length', frames); i++ ){ if (useNumericIndex && this._frames[frames[i]]) { output.push(this._frames[frames[i]].index); } else { if (this.getFrameByName(frames[i])) { output.push(this.getFrameByName(frames[i]).index); } } } } return output; } , destroy: function (){ this._frames = null ; this._frameNames = null ; } } ; Phaser.FrameData.prototype.constructor = Phaser.FrameData; Object.defineProperty(Phaser.FrameData.prototype, "total", { get: function (){ return _AN_Read_length("length", this._frames); } } );