3 秒后淡入淡出文本

Fade text after 3s

我需要在 3 秒后对某些文本应用淡出效果。以下 link 包含示例:

http://www.html5gamedevs.com/topic/8639-fade-out-text-after-2-second-delay/

但是没有用。

正文所在函数:

buyitems_lettuce: function()
{
    if(this.pet.customParams.coin >= 60)
    {
        this.pet.customParams.coin -= 60;
        this.refreshStats();
    }
    else
    {
        var buyitemsText = {font: "bold 16pt Arial", fill: "#fff"};
            buyitemsText.stroke = "#A4CED9";
            buyitemsText.strokeThickness = 5;

        this.PriceLettuceBuyItems = this.game.add.text(70,100, "No coin for buy Lettuce", buyitemsText);

    }

},
buyitems_lettuce: function () {
    if (this.pet.customParams.coin >= 60) {
        this.pet.customParams.coin -= 60;
        this.refreshStats();
    }
    else {
        var buyitemsText = {font: "bold 16pt Arial", fill: "#fff"};
        buyitemsText.stroke = "#A4CED9";
        buyitemsText.strokeThickness = 5;

        this.PriceLettuceBuyItems = this.game.add.text(70, 100, "No coin for buy Lettuce", buyitemsText);

        this.game.add.tween(this.PriceLettuceBuyItems)
                .to({alpha: 0}, 1000, Phaser.Easing.Default, true, 3000)
                .onComplete.add(function () {
                        console.log("This is called when the tween is done.");
                    }, this
                );
    }
}

这应该可以做到。