Skip to content

Commit cce09d0

Browse files
committed
Logs a descriptive consoe error frame or animation name doesn't exist
Logs the wrong name so we can see immediately what's wrong.
1 parent b114fe8 commit cce09d0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Diff for: src/easeljs/display/Sprite.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ this.createjs = this.createjs||{};
4848
*
4949
* <h4>Example</h4>
5050
*
51-
* var instance = new createjs.Sprite(spriteSheet);
52-
* instance.gotoAndStop("frameName");
51+
* var instance = new createjs.Sprite(spriteSheet);
52+
* instance.gotoAndStop("frameName");
5353
*
5454
* Until {{#crossLink "Sprite/gotoAndStop"}}{{/crossLink}} or {{#crossLink "Sprite/gotoAndPlay"}}{{/crossLink}} is called,
5555
* only the first defined frame defined in the sprite sheet will be displayed.
@@ -229,7 +229,7 @@ this.createjs = this.createjs||{};
229229
return true;
230230
};
231231

232-
//Note, the doc sections below document using the specified APIs (from DisplayObject) from
232+
//Note, the doc sections below document using the specified APIs (from DisplayObject) from
233233
//Bitmap. This is why they have no method implementations.
234234

235235
/**
@@ -336,7 +336,7 @@ this.createjs = this.createjs||{};
336336
* @return {String} a string representation of the instance.
337337
**/
338338
p.toString = function() {
339-
return "[Sprite (name="+ this.name +")]";
339+
return "[Sprite (name="+ this.name +")]";
340340
};
341341

342342
// private methods:
@@ -464,7 +464,10 @@ this.createjs = this.createjs||{};
464464
this._animation = data;
465465
this.currentAnimation = frameOrAnimation;
466466
this._normalizeFrame(frame);
467+
} else {
468+
console.error('no frame or animation named:', frameOrAnimation)
467469
}
470+
468471
} else {
469472
this.currentAnimation = this._animation = null;
470473
this._currentFrame = frameOrAnimation;

0 commit comments

Comments
 (0)