jagguy
asked on
html5 canvas loads image oddly
Hi,
My code works to load an image(s) on a canvas in html.
My question is why does this work .
To me I should not be abkle to trigger an onload function until the image has been assigned.
My code works to load an image(s) on a canvas in html.
My question is why does this work .
To me I should not be abkle to trigger an onload function until the image has been assigned.
for (i=0;i<arr1.length;i++){
images[i] = new Image();
images[i].onload = onImgLoad; //how does event trigger if there is nothing to load
images[i].src = arr1[i]; // the image to load doesnt happen until next line
}
ASKER
bit it isnt an 'if', it does load and then assign an image. it reads back to front for me.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok I might close this thread.
let me get this right that the onload function doesnt trigger until a src is attached so in this sense it is in the right order.
let me get this right that the onload function doesnt trigger until a src is attached so in this sense it is in the right order.
images[i].onload = onImgLoad; //how does event trigger if there is nothing to load
images[i].src = arr1[i]; // the image to load doesnt happen until next line
onclick : if something/someone click on this
onload : if something/someone load this