i think you should stop making new threads every time you make a tiny bit of progress and encounter a new problem. when you do this you lose all the context. nobody reading the above knows what you're talking about. there's no code, nothing.
sorry I'm under time pressure and every new method I try isn't talked about on this or any forum just the methods that I thought "should" work but are not.
ok I have extended the thread class and I have made a function to load a new gif like so:
import gifAnimation.*;
Gif water;
Loader thread2;
void setup(){
thread2 = new Loader("water");
thread2.start();
}
void draw(){
}
Gif water(){
water = new Gif(this, "waterloop.gif");
return water;
}
so what I expected to happen was:
water is a new instance of Gif class.
thread2 is a new instance of the loader class which looks for water function to run.
the water function is of type Gif. It loads the waterloop gif.
and assigns the new value to global var water?
thread2 starts.
We don't know what your Loader class looks like, you don't tell us where the NPE happens... The root cause of your problem might be that you use an object loaded in a thread before the thread has finished to fully load it.
Answers
i think you should stop making new threads every time you make a tiny bit of progress and encounter a new problem. when you do this you lose all the context. nobody reading the above knows what you're talking about. there's no code, nothing.
are you using requestImage? it sounds like it was explicitly introduced to help with the problem of background loading of images. http://processing.org/reference/requestImage_.html
sorry I'm under time pressure and every new method I try isn't talked about on this or any forum just the methods that I thought "should" work but are not.
ok I have extended the thread class and I have made a function to load a new gif like so:
so what I expected to happen was:
water is a new instance of Gif class. thread2 is a new instance of the loader class which looks for water function to run. the water function is of type Gif. It loads the waterloop gif. and assigns the new value to global var water? thread2 starts.
We don't know what your Loader class looks like, you don't tell us where the NPE happens... The root cause of your problem might be that you use an object loaded in a thread before the thread has finished to fully load it.