Images don't load while javascript while loop runs -
I am writing an image preloader for my html5 project and I've hit a problem. Images used in the game are defined in javascript with the object of the image such as:
images = new array (); Images [0] = new image (); Images [0] .src = '/images/tiles/grass.png';
As soon as the "document.ready" pre-loader function is run as shown below.
function preloader () {while (loaded! = Images.length) {var loaded = 0; For {Var loadTest = 0; loadtest
The problem is that the loop never ends because the images [loadTest] I have tested this page to run a function after loading, when the image is unnecessary and it works just fine.
For this reason I am convinced that while the loop is running, the images are stopping loading. If it is true how will I go about fixing this problem?
Optionally for a lifting event that you can load images or a setTimeout or set interlabel Voting through the call. This makes the code run in non-intercept fashion.
setInterval ('checkimages ()', 1000)
Comments
Post a Comment