Here is my attempt at the ability to test if all images are loaded:
for (var i = 0; i < imgCount; i ++) {
loadArr[i] = false
imgArr[i] = new Image
You must pass the index value to anonymous function like this,
for (var i = 0; i < imgCount; i++) {
loadArr[i] = false
imgArr[i] = new Image()
imgArr[i].src = 'img' + i + '.png'
imgArr[i].onload = function (index) {
return function () {
loadArr[index] = true //but wait! At the end of
//the loop, i is imgCount
//so this doesn't work.
};
}(i);
}