-
Creator 版本:官网稳定版v1.8.2
-
目标平台: 模拟器
代码
var node = new cc.Node(‘Button’);
var sprite = node.addComponent(cc.Sprite);
var button = node.addComponent(cc.Button);
//button.target = node;
button.transition = cc.Button.Transition.COLOR;
button.normalColor = cc.Color.YELLOW;
button.pressedColor = new cc.Color(255,0,0);
button.hoverColor = new cc.Color(255,255,255);
button.disabledColor = new cc.Color(0,0,0);
node.setPosition(250, 250);
this.node.addChild(node);
- 详细报错信息,包含调用堆栈:
2018-05-08T01:53:42.472Z - normal: Simulator: E/jswrapper (519): [ERROR] (…\jswrapper\v8\Object.cpp, 519): Invoking function (0AC48B48) failed!
2018-05-08T01:53:42.472Z - normal: Simulator: E/jswrapper (267): ERROR: Uncaught TypeError: Cannot read property ‘color’ of null, location: src/jsb_polyfill.js:0:0
2018-05-08T01:53:42.472Z - normal: Simulator: STACK:
2018-05-08T01:53:42.473Z - normal: Simulator: [0]_updateColorTransition@src/jsb_polyfill.js:5494
2018-05-08T01:53:42.473Z - normal: Simulator: [1]_applyTransition@src/jsb_polyfill.js:5508
2018-05-08T01:53:42.477Z - normal: Simulator: [2]_updateState@src/jsb_polyfill.js:5471
2018-05-08T01:53:42.477Z - normal: Simulator: [3]notify@src/jsb_polyfill.js:5275
2018-05-08T01:53:42.478Z - normal: Simulator: [4]val.set@src/jsb_polyfill.js:19345
2018-05-08T01:53:42.478Z - normal: Simulator: [5]start@assets/Script/Gashapon.js:60
2018-05-08T01:53:42.478Z - normal: Simulator: [6]anonymous@(no filename):3
2018-05-08T01:53:42.479Z - normal: Simulator: [7]invoke@src/jsb_polyfill.js:4611
2018-05-08T01:53:42.479Z - normal: Simulator: [8]startPhase@src/jsb_polyfill.js:4751
2018-05-08T01:53:42.479Z - normal: Simulator: [9]callback@src/jsb_polyfill.js:25558
如果把 button.target = node;注释去掉,没有报错,但是按钮也不显示。 有谁碰到过类似问题么