maybe this project can help: http://code.google.com/p/gwt-image-loader/
(I haven't used it yet - but it looks interessting) some other things that come to my mind: * make sure, the image is somehow attached to the dom - otherwise it will not be loaded (has been discussed in the group) * set the URL directly in the image constructor On Sep 30, 10:26 pm, Graham J <[email protected]> wrote: > Oh, and it's probably worth noting: I've added logging to onError, and > that doesn't get called either. > > On Sep 30, 12:29 pm, Graham J <[email protected]> wrote: > > > So, I'm trying to do some things with an image after it has loaded. > > But it seems like the onLoad only get called sporadically, and I'm not > > sure what the logic is. I would expect that this gets called either: > > Once per image per page load, or once per image instance per page > > load. (Really, I expect the second case, but if it was the first case > > that wouldn't shock me.) > > > As it is, it makes working with the image impossible, because there is > > no way to guarantee an image exists on the page before working with > > it. If the loadlistener fired reliably, or if there was some kind of > > 'isLoaded()' method, that would be extremely useful. (Preferably the > > load listener.) > > > Here is a sample of what I'm doing: > > _________________________________ > > > Image i = new Image(""); > > i.addLoadListener(new LoadListener() > > { > > public void onError(Widget sender) { } > > > public void onLoad(Widget sender) > > { > > Image i = (Image)sender; > > i.doStuff(); > > } > > } > > ); // end of addLoadListener > > i.setUrl("/foo.jpg"); > > m_content.add(i); > > _________________________________ > > > If I do this for 5 different images in a row, 1 or 2 of them will > > never call doStuff(). > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
