Note that there are some explanatory texts on larger screens.

plurals
  1. POAn interval that calls a function inside an object, which also calls a function inside that object
    primarykey
    data
    text
    <pre><code>function airEngineJS (canvasArg, properties) { this.canvas = (canvasArg == "undefined")? trace("Failed to set up canvas for airEngineJS") : canvasArg; this.cameras = []; this.displayObjects = []; this.hudDisplayObjects = []; this.fps = (properties == "undefined" || properties.fps == "undefined")? 30 : properties.fps; if (properties == "undefined" || properties.autoinit == "undefined" || properties.autoinit == true){ this.keyboard = new keyboardJS(); this.keyboard.init(); this.cameras.push(new airCameraJS(this)); } this.enterframe = setInterval(this.intervalCaller, 1000/this.fps); trace("A new airEngineJS has been created"); } airEngineJS.prototype = { intervalCaller : function () { this.mainLoop(); }, logic : function () { for (var i = 0; i &lt; this.displayObjects.length; ++i){ this.displayObjects[i].logic(); } for (var j = 0; j &lt; this.cameras.length; ++j){ this.cameras[j].logic(); } }, render : function () { for (var i = 0; i &lt; this.cameras.length; ++i){ for (var j = 0; j &lt; this.displayObjects.length; ++j){ this.displayObjects[j].renderOn(this.cameras[i]); } } for (var i = 0; i &lt; this.hudDisplayObjects.length; ++i){ this.hudDisplayObjects[i].renderOn(this.canvas); } }, mainLoop : function () { this.logic(); this.render(); } } </code></pre> <p>The interval [this.enterframe = setInterval(this.intervalCaller, 1000/this.fps);] calls correctly (this.intervalCaller), but this tries to call (this.mainLoop()) in the DOM.</p> <p>Any suggestions about how should I do it? :(</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload