waqasqureshi
waqasqureshi

Reputation: 79

How to assign value to "text" property of "someText" object in kinetic js?

Here is the code below: Actually I am using a loop in which i want to assign value to "text" property

var someText=new Kinetic.Text({
    x:stage.width()-50,
    y:stage.height()/4,
    text:9, //i want to change value of this property
    fill:'green',
    fontSize:14,
    fontFamily:'Verdana'
});

someText.text()=19;  // here is the error fires

"invalid assignment left-hand side" error fires in the above statement. pls help? If i execute alert(someText.text()) its works fine and 9 is displayed

Upvotes: 0

Views: 76

Answers (2)

Gerard de Visser
Gerard de Visser

Reputation: 8050

The way you try to set your text is not valid. Try:

someText.setText('19');

Upvotes: 0

Unknownman
Unknownman

Reputation: 483

Try this code

someText.text("19"); 

Upvotes: 1

Related Questions