We are about to switch to a new forum software. Until then we have removed the registration on this forum.
If I wanted to write code in one applet's "draw" to display an image in the other, what would I do?
In the situation below, if I move "image(example.get(0),0,0);" to draw and put "sa." or "SecondApplet." in front of it. I get an error that the name isn't recognizable or that I'm mixing static with non-static. How would I refer to the second applet in this case?
ArrayList<PImage> example = new ArrayList<PImage>();
void setup() {
size(100, 100);
text.add(loadImage("example.png"));
String[] args = {"TwoFrameTest"};
SecondApplet sa = new SecondApplet();
PApplet.runSketch(args, sa);
}
void draw() {
background(0);
ellipse(50, 50, 10, 10);
}
public class SecondApplet extends PApplet {
public void settings() {
size(200, 100);
}
public void draw() {
background(255);
fill(0);
ellipse(100, 50, 10, 10);
//////////
image(example.get(0),0,0);
/////////
}
}
Answers
@LaxOfBayDay===
line 29 change it for: image(text.get(0),0,0):
Sorry that was a mistake. In my program the image is called "text" but in this small example replicating the problem I was trying to change the name to "example".
Edited.
The name's not the issue. I'm wondeing how I could move line 29 to line 16, and still have the image appear in SecondApplet.
You are there... Check this.
Kf