We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everybody Here's a problem I've troubled for few days. I try to display images from a folder called "background" in the data folder, the "background" folder contains 19 folders(which name are 1,2,3,4,5.......19) and the 19 folders contain a different number of images. for instance, the folder 1 have 1 image, and folder 2 has 3 images (images name are 1,2,3) and so on.
what I want to achieve is that, the project will display all images within folder 1,2,3,4...19. Display one folder once. When the mouse clicked it will jump to next folder and automatically display images within this folder, for example from folder 1(display 1 image) to folder 2 (display 3 images sequentially as 1,2,3).
Here is my code! It does not work very well. Thanks for any help!!
ArrayList<PImage>imgs = new ArrayList<PImage>();
int id=0;
void setup() {
size(800, 800);
}
void draw() {
if (id==0) {
imgs.add(loadImage("background/1/1.png"));
}
}
void mouseClicked() {
if (id<19) {
imgs.add(loadImage("background/"+(id+1)+".png"));
id++;
}
}
Answers
Check this post for another way to do it:
https://forum.processing.org/two/discussion/3651/selectfolder-image-filter
Kf