From cce09d08fac9546fd39fdb945cd67c978bf01373 Mon Sep 17 00:00:00 2001 From: innerdesign Date: Sat, 20 Aug 2016 12:35:14 -0400 Subject: [PATCH 1/3] Logs a descriptive consoe error frame or animation name doesn't exist Logs the wrong name so we can see immediately what's wrong. --- src/easeljs/display/Sprite.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/easeljs/display/Sprite.js b/src/easeljs/display/Sprite.js index c9f6bf4c8..4091d1229 100644 --- a/src/easeljs/display/Sprite.js +++ b/src/easeljs/display/Sprite.js @@ -48,8 +48,8 @@ this.createjs = this.createjs||{}; * *

Example

* - * var instance = new createjs.Sprite(spriteSheet); - * instance.gotoAndStop("frameName"); + * var instance = new createjs.Sprite(spriteSheet); + * instance.gotoAndStop("frameName"); * * Until {{#crossLink "Sprite/gotoAndStop"}}{{/crossLink}} or {{#crossLink "Sprite/gotoAndPlay"}}{{/crossLink}} is called, * only the first defined frame defined in the sprite sheet will be displayed. @@ -229,7 +229,7 @@ this.createjs = this.createjs||{}; return true; }; - //Note, the doc sections below document using the specified APIs (from DisplayObject) from + //Note, the doc sections below document using the specified APIs (from DisplayObject) from //Bitmap. This is why they have no method implementations. /** @@ -336,7 +336,7 @@ this.createjs = this.createjs||{}; * @return {String} a string representation of the instance. **/ p.toString = function() { - return "[Sprite (name="+ this.name +")]"; + return "[Sprite (name="+ this.name +")]"; }; // private methods: @@ -464,7 +464,10 @@ this.createjs = this.createjs||{}; this._animation = data; this.currentAnimation = frameOrAnimation; this._normalizeFrame(frame); + } else { + console.error('no frame or animation named:', frameOrAnimation) } + } else { this.currentAnimation = this._animation = null; this._currentFrame = frameOrAnimation; From 288e9bb941d0847d99cb07a05051a3953b0e38b6 Mon Sep 17 00:00:00 2001 From: innerdesign Date: Sat, 20 Aug 2016 12:41:10 -0400 Subject: [PATCH 2/3] Revert "Logs a descriptive consoe error frame or animation name doesn't exist" This reverts commit cce09d08fac9546fd39fdb945cd67c978bf01373. --- src/easeljs/display/Sprite.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/easeljs/display/Sprite.js b/src/easeljs/display/Sprite.js index 4091d1229..c9f6bf4c8 100644 --- a/src/easeljs/display/Sprite.js +++ b/src/easeljs/display/Sprite.js @@ -48,8 +48,8 @@ this.createjs = this.createjs||{}; * *

Example

* - * var instance = new createjs.Sprite(spriteSheet); - * instance.gotoAndStop("frameName"); + * var instance = new createjs.Sprite(spriteSheet); + * instance.gotoAndStop("frameName"); * * Until {{#crossLink "Sprite/gotoAndStop"}}{{/crossLink}} or {{#crossLink "Sprite/gotoAndPlay"}}{{/crossLink}} is called, * only the first defined frame defined in the sprite sheet will be displayed. @@ -229,7 +229,7 @@ this.createjs = this.createjs||{}; return true; }; - //Note, the doc sections below document using the specified APIs (from DisplayObject) from + //Note, the doc sections below document using the specified APIs (from DisplayObject) from //Bitmap. This is why they have no method implementations. /** @@ -336,7 +336,7 @@ this.createjs = this.createjs||{}; * @return {String} a string representation of the instance. **/ p.toString = function() { - return "[Sprite (name="+ this.name +")]"; + return "[Sprite (name="+ this.name +")]"; }; // private methods: @@ -464,10 +464,7 @@ this.createjs = this.createjs||{}; this._animation = data; this.currentAnimation = frameOrAnimation; this._normalizeFrame(frame); - } else { - console.error('no frame or animation named:', frameOrAnimation) } - } else { this.currentAnimation = this._animation = null; this._currentFrame = frameOrAnimation; From 05413880ded89a31ce49b763dd0a8be884d6fd66 Mon Sep 17 00:00:00 2001 From: innerdesign Date: Sat, 20 Aug 2016 12:52:51 -0400 Subject: [PATCH 3/3] Logs a descriptive console error if the frame or animation name doesn't exist. Logs the wrong name so we can see immediately what's wrong. --- src/easeljs/display/Sprite.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/easeljs/display/Sprite.js b/src/easeljs/display/Sprite.js index c9f6bf4c8..9e7e199f2 100644 --- a/src/easeljs/display/Sprite.js +++ b/src/easeljs/display/Sprite.js @@ -464,6 +464,8 @@ this.createjs = this.createjs||{}; this._animation = data; this.currentAnimation = frameOrAnimation; this._normalizeFrame(frame); + } else { + console.error('no frame or animation named:' + frameOrAnimation) } } else { this.currentAnimation = this._animation = null;