Sign in to follow this  

[web] Trouble preloading images with javascript

This topic is 4305 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[i] = new Image() this.frame[i].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[tt].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

This topic is 4305 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this