cc.Class({ extends: cc.Component, properties: { closeBtn: { default: null, type: cc.Node }, submitBtn: { default: null, type: cc.Node }, resultPrefab: { default: null, type: cc.Prefab } }, // LIFE-CYCLE CALLBACKS: onLoad () { let self = this; this.closeBtn.on('click', function () { self.node.removeFromParent(true); }); this.submitBtn.on('click', function () { self.showResultView(); }) }, start () { }, showResultView() { let result = cc.instantiate(this.resultPrefab); this.top.node.addChild(result, 11); this.node.removeFromParent(true); } });