diff --git a/cocos2d/animation/animation-animator.js b/cocos2d/animation/animation-animator.js index 949bef9044..a23a35caa6 100644 --- a/cocos2d/animation/animation-animator.js +++ b/cocos2d/animation/animation-animator.js @@ -60,13 +60,40 @@ p.resumeState = function (state) { if (state) { state.resume(); } + + if (this.isPaused) { + this.resume(); + } }; p.setStateTime = function (state, time) { if (state) { state.setTime(time); } -} +}; + +p.onStop = function () { + var anims = this.playingAnims; + for (var i = 0, l = anims.length; i < l; i++) { + anims[i].stop(); + } + + Animator.prototype.onStop.call(this); +}; + +p.onPause = function () { + var anims = this.playingAnims; + for (var i = 0, l = anims.length; i < l; i++) { + anims[i].pause(); + } +}; + +p.onResume = function () { + var anims = this.playingAnims; + for (var i = 0, l = anims.length; i < l; i++) { + anims[i].resume(); + } +}; if (CC_DEV) { p.reloadClip = function (state) {