I’ve preloaded 12 images
[CODE]
function preload(imgObj,imgSrc) {
eval(imgObj+’ = new Image()’)
eval(imgObj+’.src = “‘+imgSrc+'”‘)
}
preload(‘img1′,’b1.gif’)
etc…..
In a -for- loop I have
[CODE]
document.images[‘imgcon’+y+x].src = “img+rand(1,12)+.src”;
this is seen as ‘img1.src’ instead of the object (or img2,img3 etc)
[CODE]
document.images[‘imgcon’+y+x].src = img+rand(1,12)+.src;
I get –object expected
[CODE]
document.images[‘imgcon’+y+x].src = img1.src; (or img2,img3 etc)
works
or
[CODE]
document.images[‘imgcon’+y+x].src = “b”+rand(1,12)+”.gif”
works
So the 12 image objects exist but I can’t get the syntax right to get the code to add a random number after ‘img’ and not see it as a string.
Any Help??