I'm trying to find out if I can do something like this in HTML5 + Javascript. I would also prefer doing this in pure javascript and not use a library like jQuery. Here's an example of what I'm trying to do:
(I come from Lua so please forgive my code, I don't know how to code in Javascript yet but it should be readable so you can understand what I'm trying to do. Thanks in advance and sorry for the trouble)
table = { "Image1", "Image2", "Image3" }
images = {}
for i = 0, 100 do
images[i] = newImage( "images/" + table[i] + ".png" )
images[i].x = 30 * i
images[i].num = i
images[i].addEventListener( onTouchDown, doSomething )
end
This would load 101 images, take the names of the images from a table and give each image an event listener. Is this possible? Thanks in advance for any information on the topic!
images[i] = 30 * ibit meant to be doing? It replaces the new image stored inimages[i]with the number30 * i, which can't be intended behavior...