[4941] in java-interest
found a bug in MediaTracker?
daemon@ATHENA.MIT.EDU (David Lebel)
Tue Jan 23 15:24:42 1996
Date: Tue, 23 Jan 1996 12:32:36 -0500
From: David Lebel <lebel@socom.com>
Reply-To: lebel@socom.com
To: java-interest@java.sun.com
Hello,
Is it me, or when I try to waitForID(int) or waitForAll() on already
loaded images, I freeze everything?
Here is my prefetcher:
public int prefetchID = 0;
public Image prefetch(URL myURL) {
Image im = parent.getImage(myURL);
MediaTracker mt = new MediaTracker(parent);
dbg("fetching '"+myURL.toExternalForm()+"'");
mt.addImage(im, prefetchID);
try {
mt.waitForID(prefetchID++);
} catch (Exception e) {
System.out.println("Error while waiting for image '"
+myURL.toExternalForm()+"'");
return null;
}
return im;
}
The problem is that, as soon as I try to call prefetch(URL) to
an already loaded image, my applet freeze. That happens with my cool
ImageMap applet I'm developping where some animations frames are used
across animated buttons. For example, for a button, I have two
animations, one that plays a waving duke, and another that plays the
very first frame of that classic animation. So, when you pass over
the animation component, duke waves at you, and when you leave the
animation component (remove the mouse cursor outside), then it stop
waving at you. The problem is that the first frame of both anims are
the same file and mediatracker seems to wait forever when it wait for
it the second time. Is this the normal behaviour, or is there some
sort of solution to this problem?
...David
--
// David Lebel <lebel@socom.com> http://www.socom.com/~lebel/
\\ Socom technologies, Inc. Tel: 514/939-0480 Fax: 514/939-0834
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com