This code is almost taken directly out of a book but it just doesn’t seem to work, i removed the loop and just set up all the different indexes of the array with the image src etc. and it worked so i think theres something simple im doing wrong here. Can anyone see what is wrong with this snippet of code?
var demo = new Array();
var titleNumFrames = 7;
for(x=0; x<titleNumFrames; x++) {
demo[x]=new Image();
demo[x].src = “image”+x+”.jpg”;
}
When i said it did not work, i meant the images just weren’t being preloaded and sometimes strange things would happen only when that for loop was in the code. Ended up being the quote marks, simple mistake – wont be copy code out of word/powerpoint files in future!
Your text editor (more like word processor) or keybindings are erroneously replacing normal quotes
"in your code with smart quotes“.