我正在使用flash cc createjs导出。我也是嵌入式flash字体。但它没有解决问题。 我在这里附上了链接。只需单击矩形。它将创造10 如果你再次点击它将是20。但是20个重叠10个。 10不会消失。 http://graphicscoder.org/stackover/score/scoring.html
/* js
var score=0;
this.movieClip_1.addEventListener('click', fl_MouseOverHandler_2);
function fl_MouseOverHandler_2(e)
{
text1 = new createjs.Text("LIVES: " + score, "40px Arial");
text1.textAlign = 'right';
text1.y = 30;
text1.x = stage.canvas.width - 10;
stage.addChild(text1);
score=score+10;
text1.text=String(score);
}
*/
答案 0 :(得分:0)
每次单击该按钮,都会添加新文本。如果您只想更改数字:
示例:
/* js
var score=0;
this.movieClip_1.addEventListener('click', fl_MouseOverHandler_2);
// Moved out of the mouse handler
text1 = new createjs.Text("LIVES: " + score, "40px Arial");
text1.textAlign = 'right';
text1.y = 30;
text1.x = stage.canvas.width - 10;
stage.addChild(text1);
function fl_MouseOverHandler_2(e)
{
score=score+10;
text1.text=String(score);
}
*/