How can I make a Javascript event to trigger after all images in an array are loaded?
问题 I am working on an HTML5 Canvas game, and the level needs to pre-load some images (and eventually other data such as audio files, too). I am planning on having all of these images stored in an array, or a container object. What I need to do is find a way to wait until all of these images are downloaded completely before continuing in the game. This does NOT happen when the page is opened. This happens deep within the running script, and the images are dynamically loaded. The idea is to