Monday, September 27, 2010

Help With LoadHandler

I have an application where an Image object gets an updated url quite
often from the result of a user action. I'm running into problems
where if the image is updated (i.e., the setUrl() method is called)
more than once before the image is actually loaded, then the image
doesn't load correctly.

So I'm looking into using LoadHandler and I can't seem to make it
work, nor can I find any examples of its use. I figured setting a
loading flag when the setUrl() is called and only allowing the call to
complete if we're not loading. For example:

if(!loading) {
loading = true;
super.setUrl(url);
}

And then when the load event comes in (from what I can tell, the only
event type is 'load'), then so something like this:

public void onLoad(LoadEvent event) {
loading = false;
}

But this isn't working. It's hard to track down why this isn't
working because I have a few hundred images that can get changed very
rapidly.

I'm not really looking for help with my specific example but more
looking for general examples using the LoadHandler.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment