In the following function, the first debug output line ("debugPut"), produces what seems like a valid result:
X: 427 Y: 197src=http://www.mygameslab.com/Switch/settingsScreen.png
and even pasting the image link itself correctly displays the screen graphics.
However, the screen never displays and the next debug text which was supposed to print "Kukuriiiiiiku" doesn't seem to print anything - which implies to me that settingsScr never gets triggered.
Any idea what could be causing this?
Many thanks in advance if you try to help!
------------------------
function handleSettings() //Handles the settings screen
{
var settingsX = Math.floor((xSize-settingsScr.width)/2); //the centered X location of the settings window
var settingsY = Math.floor((ySize-settingsScr.height)/2); //the centered Y location of the settings window
document.getElementById("debugPut").innerHTML= ("X: "+settingsX+" Y: "+settingsY+"src="+settingsScr.src); // for debug
settingsScr.onload = function () //make sure resource was loaded first
{ //shows the bg image only once it was loaded
document.getElementById("debugPut").innerHTML= ("Kukuriiiiiiku"); // for debug
gameBoard.drawImage(settingsScr,settingsX,settingsY);
document.getElementById("debugPut").innerHTML= ("X2: "+settingsX+" Y: "+settingsY+"src="+this.src); // for debug
};
}