• Advertisement
Sign in to follow this  

[web] Trouble preloading images with javascript

This topic is 4372 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am having trouble loading images in Internet Explorer. The code runs as intended in Netscape, Firefox, and Opera, but not IE :( I would like help fixing or making my code more compatible w/o breaking it in the other browsers (I hope its possible). <code> //My sprite class image loader function Sprite(path, ext) { this.frame = new Array(); for (i = 0; i < 32; i++) { this.frame = new Image() this.frame.src = path + i + ext } } //Code that updates image based on its direction function UpdateRotation() { //Updates character's position and direction after all actions are processed if (this.hasRotated != 0) {return;} //this.hasRotated = 1; var deg = (this.angle * radtodeg); gg = 5.625 for (tt = 1 ; tt < 32; tt++) { if ((gg <= deg) && (deg <= (gg += 11.25))) { if (!this.spriter) {return;} document.getElementById(this.id).src = this.spriter.frame.src return; } } if ((348.75 <= deg) || (deg <= 11.25)) {this.ObRef().src = this.spriter.frame[0].src;} } </code>

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement