定义了如下的动画播放
spark: function () {
var animationpo = this.getComponent(cc.Animation);
animationpo.play(“small”);
setTimeout(“animationpo.destroy();”,500);
},
可是报了如下错误:

我没定义animationpo?我不是定义了animationpo吗?
你直接写的 "animationpo.destroy();" 是通过 eval解析的,调用的是全局的 window.animationpo,所以不存在。
你应该把调用方法写在箭头函数 ()=>{ } 内,这样才能保持你当前调用函数的作用域。
你是说写成
?
this.node.getComponent