cc.Class({
extends: cc.Component,
properties: {
bgSprite1: {
default: null,
type: cc.Node
},
bgSprite2: {
default: null,
type: cc.Node
},
Xlabel:{
default: null,
type: cc.Label
},
moveSpeed: 0,
moveTime: 0,
},
// use this for initialization
onLoad: function () {
},
update: function(dt){
this.Xlabel.string = 'X: ' + this.bgSprite1.getPositionX();
this.BackgroundA = this.bgmoveAction();
this.node.runAction(this.BackgroundA);
},
bgmoveAction: function(){
var bgmove = cc.moveBy(this.moveTime, cc.p(-this.moveSpeed, 0)).easing(cc.easeCubicActionOut());
return bgmove;
},
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});
会报错:this.bgSprite1.getPositionX();不是函数,求大神解释一下
节点绑定不是在这里绑定?我新人,怎么使用代码绑定?