cocos creator 2.4 + 最新的库 报错

fairygui.js:17097 Uncaught TypeError: Cannot set property 'width' of undefined
at GearSize.updateState (fairygui.js:17097)
at GLoader.GObject.updateGear (fairygui.js:1253)
at GLoader.GObject.setSize (fairygui.js:942)
at RelationItem.applyOnSizeChanged (fairygui.js:11198)
at RelationItem.__targetSizeChanged (fairygui.js:11399)
at EventTarget.285.proto.emit (callbacks-invoker.js:341)
at cc_Node.emit (CCNode.js:2365)
at GButton.GObject.setSize (fairygui.js:949)
at GButton.GObject.setup_beforeAdd (fairygui.js:1749)
at GComponent.constructFromResource2 (fairygui.js:2919)
是在载入界面创建控件时报错,之前的版本不会
GearSize.prototype.updateState = function () {
var gv = this._storage[this._controller.selectedPageId];
if (!gv)
this._storage[this._controller.selectedPageId] = {};
gv.width = this._owner.width;
gv.height = this._owner.height;
gv.scaleX = this._owner.scaleX;
gv.scaleY = this._owner.scaleY;
};
gv 为undefined
if (!gv)
gv=this._storage[this._controller.selectedPageId] = {};
改成这样就好了  
已邀请:

谷主

赞同来自:

确实是笔误。改好了。

要回复问题请先登录注册