<!-- The runtime script. You can rename it, but don't forget to rename the reference here as well.
This file will have been minified and obfuscated if you enabled "Minify script" during export. -->
<script src="c2runtime.js"></script>
<script>
var element = document.getElementById('c2canvas');
fgl.create(element, 'com.fgl.gamename');
//fgl.onReady(function(){loadGame();}
</script>
<script>
// Size the canvas to fill the browser viewport.
//var loadGame = function() {
jQuery(window).resize(function() {
cr_sizeCanvas(jQuery(window).width(), jQuery(window).height());
});
// Start the Construct 2 project running on window load.
jQuery(document).ready(function ()
{
// Create new runtime using the c2canvas
cr_createRuntime("c2canvas");
});
// Pause and resume on page becoming visible/invisible
function onVisibilityChanged() {
if (document.hidden || document.mozHidden || document.webkitHidden || document.msHidden)
cr_setSuspended(true);
else
cr_setSuspended(false);
};
document.addEventListener("visibilitychange", onVisibilityChanged, false);
document.addEventListener("mozvisibilitychange", onVisibilityChanged, false);
document.addEventListener("webkitvisibilitychange", onVisibilityChanged, false);
document.addEventListener("msvisibilitychange", onVisibilityChanged, false);
//}
</script>
</body>
</html>
This is the final part of index.html , if I uncomment the parts you suggested to me the game doesn't load at all.
mammoth The fgl api works, Pixel rebirth suggested that the game should load only after the FGl API has initialised. Now the game loads regardless if API was initialised . If there is a problem at FGL the game will load and throw errors when FGL api stuff is called. If the game was loaded only after the fgl api initialisation the game wouldn;t load at all.