Jump to content
  • Advertisement
Sign in to follow this  
kylecrass

[web] Trouble preloading images with javascript

This topic is 4641 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!