Jump to content

text.setText is not a function


Techbot
 Share

Recommended Posts

I've copied the example from http://phaser.io/examples/v2/text/kern-of-duty

 

You can see it in action here http://eclecticmeme.com/

 

Most of the time I get 7 letters. Sometimes I get 9.

 

I note that in the example the line above it (line 41) is commented out.

 

Anyway

 

If text is set as global and then set to game.add.txt(), what could prevent  text.setText() from being accessible?

 

my js is here

 

I'm sure it's something stupid I'm missing.

 

//////////////////////////////////////////////////

function create() {

    game.add.sprite(0, 0, 'cod');

    text = game.add.text(32, 380, '', { font: "30pt Courier", fill: "#19cb65", stroke: "#119f4e", strokeThickness: 2 });

    nextLine();

}

function updateLine() {

    if (line.length < content[index].length)
    {
        line = content[index].substr(0, line.length + 1);
        // text.text = line;
        text.setText(line);
    }
    else
    {
        //  Wait 2 seconds then start a new line
        game.time.events.add(Phaser.Timer.SECOND * 2, nextLine, this);
    }

}
 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...