cocoscreator 怎么显示隐藏

cocoscreator 怎么显示隐藏

start() {
this.node.active = false;

    // this.node.x=-400;
    // this.node.y=-400;
    // 
    var windowSize = cc.winSize; //推荐  原因  短
    cc.log("width=" + windowSize.width + ",height=" + windowSize.height);
    this.node.scaleY = windowSize.height / this.node.height + 0.2;
    this.node.scaleX = 1.2;


    console.log(this.node);

    setTimeout(function(){
          alert(1);
           this.node.active = true;
    },2000)
},

2秒后并不会显示呀

肯定有报错信息,active 已经是undefined了
应该这样写
let _this = this;
setTimeout(function () {
alert(1);
_this.node.active = true;
}, 2000)

或者
setTimeout(() => {
alert(1);
this.node.active = true;
}, 2000);