We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › frustrated!
Page Index Toggle Pages: 1
frustrated! (Read 450 times)
frustrated!
Jul 21st, 2006, 7:46am
 
as far as i can see, this should work. if someone could enlighten me as to why no images display, i would appreciate it.

int foldNo = 1;  
int loaded = 1;  
int numImage;  
int interval = 5000;

long previousMillis = 0;

boolean trig = false;

PImage pics;  

File[] files = new File("/Users/eriklynd/Desktop/Folders/Track1").listFiles();
String filenames[] = new String[files.length];

void setup()
{
 size(640, 480, P3D);    
 numImage = files.length;  
 pics = loadImage(files[loaded].getAbsolutePath());
}

void draw()
{  
 folder();
 timer();
 image(pics, 0, 0);
}

void folder()                          
{
 files = new File("/Users/eriklynd/Desktop/Folders/Track" + foldNo).listFiles();
 String filenames[] = new String[files.length];
 numImage = files.length;          
}

void keyPressed()

{
 if(keyPressed){
   if(key == '1'){
     foldNo = 1;
     loaded = 0;
   }
   if(key == '2'){
     foldNo = 2;
     loaded = 0;
   }
   if(key == '3'){
     foldNo = 3;
     loaded = 0;
   }
   if(key == '4'){
     foldNo = 4;
     loaded = 0;
   }
   if(key == '5'){
     foldNo = 5;
     loaded = 0;
   }
   if(key == '6'){
     foldNo = 6;
     loaded = 0;
   }
   if(key == '7'){
     foldNo = 7;
     loaded = 0;
   }
   if(key == '8'){
     foldNo = 8;
     loaded = 0;
   }
   if(key == '9'){
     foldNo = 9;
     loaded = 0;
   }
   if(key == '0'){
     foldNo = 10;
     loaded = 0;
   }
   if(key == 'q'){
     foldNo = 11;
     loaded = 0;
   }
   if(key == 'w'){
     foldNo = 12;
     loaded = 0;
   }
   if(key == 'e'){
     foldNo = 13;
     loaded = 0;
   }
   if(key == 'r'){
     foldNo = 14;
     loaded = 0;
   }
   if(key == 't'){
     foldNo = 15;
     loaded = 0;
   }
   if(key == 'y'){
     foldNo = 16;
     loaded = 0;
   }
   if(key == 'u'){
     foldNo = 17;
     loaded = 0;
   }
   if(key == 'i'){
     foldNo = 18;
     loaded = 0;
   }
   if(key == 'o'){
     foldNo = 19;
     loaded = 0;
   }
   if(key == 'p'){
     foldNo = 20;
     loaded = 0;
   }
 }
}

void timer()
{
 if(millis() - previousMillis > interval){
   print("tick");
   previousMillis = millis();
   loaded += 1;
   pics = loadImage(files[loaded].getAbsolutePath());
   if(loaded == numImage){  
     loaded = 1;    
   }
 }
}


Re: frustrated!
Reply #1 - Jul 23rd, 2006, 12:43am
 
ok... i'm bumping this...

i've done a few more tests, and am a bit confused... perhaps there is a bug to blame??? my old sketches that use .bmp as the image type work great on beta 115, but any new sketches will not load the images at all! even the most basic sketch like that from the example page doesn't work with bmps, but has no problem loading jpgs (extreamly slow!!!). any input would be appreciated.
Re: frustrated!
Reply #2 - Jul 23rd, 2006, 6:56am
 
ok... definately a bug!

i can use bmp images on old sketches, but anything new i write won't display them... code works find with jpg images, and purging my machine of its cache has made all the awefull delays i had with jpg images and loadImage() go away.
Page Index Toggle Pages: 1