Help setInterval not working
Help setInterval not working
var play;
function myfunction()
{
var d = LL.getCurrentDesktop();
var b = d.getPositionX();
var x = b/2;
d.getItemByName(“Welcome”).setPosition(x,0);
}
setInterval(myfunction,10)
myfunction();
]]>
< ![CDATA[
setInterval? Don’t you mean setTimeout?
]]>
< ![CDATA[
I’m not sure what you’re trying to do in this code. Why are you calling myfunction() again if you’re using an interval? Also, your setInterval syntax is incorrect — should be setInterval(myfunction(), 10); < -- note your sample code doesn't terminate with a ;. But, yes, why use setInterval at all, you'd be calling the function 100 times per second while nothing seems to be changing in your variables.
]]>
< ![CDATA[
Lighting is not a full html canvas.
setInterval is not implemented. setTimeout is.
You need to use setInterval(myfunction,10) inside your function, so it is called again 10 milliseconds after it is executed.
Mark: the syntax is correct (if that code were from html JavaScript). Your suggestion will run the function and won’t add the internal, the ; is optional and the positionX of the desktop probably changes over time.
]]>
< ![CDATA[
Ah, dang, thanks TrianguloY for setting me straight.
]]>