diff --git a/cocos2d/core/components/CCLabel.js b/cocos2d/core/components/CCLabel.js index 346e395b01..6c2b848643 100644 --- a/cocos2d/core/components/CCLabel.js +++ b/cocos2d/core/components/CCLabel.js @@ -306,6 +306,17 @@ var Label = cc.Class({ if (!cc.sys.isNative) { this._sgNode.on('load', this._updateNodeSize, this); } + + }, + + onEnable: function() { + this._super(); + cc.director.on(cc.Director.EVENT_BEFORE_VISIT, this._updateNodeSize, this); + }, + + onDisable: function() { + this._super(); + cc.director.off(cc.Director.EVENT_BEFORE_VISIT, this._updateNodeSize, this); }, _createSgNode: function () { diff --git a/cocos2d/core/components/CCScrollView.js b/cocos2d/core/components/CCScrollView.js index 48edbff334..a1b17e7546 100644 --- a/cocos2d/core/components/CCScrollView.js +++ b/cocos2d/core/components/CCScrollView.js @@ -1025,11 +1025,19 @@ var ScrollView = cc.Class({ onLoad: function () { if (!CC_EDITOR) { this._registerEvent(); + if(cc.isValid(this.content)) { + this.content.on('size-changed', this._calculateBoundary, this); + } + this.node.on('size-changed', this._calculateBoundary, this); + this._calculateBoundary(); } }, - start: function() { - this._calculateBoundary(); + onDestroy: function() { + if(cc.isValid(this.content)) { + this.content.off('size-changed', this._calculateBoundary, this); + } + this.node.off('size-changed', this._calculateBoundary, this); }, update: function(dt) {