在下面的代码中,当我单击circle
它的意思是更新使用的文本属性txt
但txt.Text = "gffdfgdsgsdgsdg";
它不起作用?你知道怎么做吗?
function init() {
var canvas = document.getElementById('easel');
var stage = new createjs.Stage(canvas);
var circle = new createjs.Shape();
circle.graphics.beginFill("rgba(255,255,255,1)").drawCircle(40, 40, 40);
var shape = new createjs.Shape();
shape.graphics.s('red').ss(10, 'round', 'round').mt(50, 50).lt(250, 250).lt(50, 250).cp();
var shape2 = new createjs.Shape();
shape2.graphics.s('blue').ss(20, 'round', 'round').mt(200, 50).lt(250, 250).lt(50, 250).cp();
var txt = new createjs.Text("Hello CreateJS!", "15px Arial", "#FFF");
txt.y = 45;
shape.onClick = function (event) {
this.x -= 1;
};
shape2.onClick = function (event) {
this.x += 3;
};
circle.onClick = function (event) {
alert('fhdfhdfhg');
var s = this.x + ' y:' + this.y;
//txt.Text = "dfsdfs";
txt.Text = "gffdfgdsgsdgsdg";
};
stage.addChild(shape);
stage.addChild(shape2);
stage.addChild(circle);
stage.addChild(txt);
//Update stage will render next frame
createjs.Ticker.setFPS(15);
createjs.Ticker.addEventListener("tick", handleTick);
function handleTick() {
console.log('test');
circle.x += 2;
stage.update();
}
}