I have large images to display that might take some time to make their
way to the browser.  When a user requests a new image I'd like to
display a generic "loading" image and then replace that image url with
the correct one when loaded (note, this is using one image object).  I
have it working in Firefox and Safari, but IE never gets the alert.
Here's the basics of the code:

public class SwapImage extends Image implements LoadListener {
  private String url = null;

  public SwapImage() {
    super(BLANK_IMG_URL);
    addLoadListener(this);
  }

  public void setUrl(String url) {
    this.url = url;

    // first set the url to the loading image
    super.setUrl(LOADING_IMG_URL);
  }

  public void onLoad(Widget sender) {
    if(url == null) return; // to abort on the second load alert

    // url needs to be null before calling setUrl()
    String s = url;
    url = null;

    // on the first load alert this url represents the img we're
interested in
    super.setUrl(s);
  }
}

I might be able to make things work with a new Image object each time
a new URL is needed, but I'd really like to avoid that.  Is there
anything I'm missing that would make this work in IE?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to