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();

]]>

4 Commentsto Help setInterval not working

  1. Anonymous says:

    < ![CDATA[

    setInterval? Don’t you mean setTimeout?

    ]]>

  2. Anonymous says:

    < ![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.

    ]]>

  3. Anonymous says:

    < ![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.

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Ah, dang, thanks TrianguloY for setting me straight.

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *