Html5 canvas settimeout Problem
hi,
have problem html5 canvas settimeout.
created 1 round drawing object, instance name ball. code following as,
code:
this.ball.x = 1000;
settimeout(calledfun, 500);
function calledfun()
{
alert("fun called");
this.ball.x = 100;
}
this code function worked, alert display. ball x positon not changed.
so please me
thanks in advance
you lost reference 'this'. try:
var tl = this;
this.ball.x = 1000;
settimeout(calledfun, 500);
function calledfun()
{
alert("fun called");
tl.ball.x = 100;
}
More discussions in Adobe Creative Cloud
adobe
Comments
Post a Comment