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 › web applet fails to run
Page Index Toggle Pages: 1
web applet fails to run (Read 496 times)
web applet fails to run
Mar 5th, 2007, 8:50pm
 
hello,

i wrote a programm that displays images randomly. after a mouseclick another pair will be shown. on my maschine it runs without any problems.

exported it and uploaded the applet to a webspace to test, the programm did not function anymore.

the java concole says:
file image "0.jpg" is missing or inaccessible, make sure the URL ...

i placed the images into the same directory the applet is.

here is the code:

Quote:


int bilderanzahl = 22;
int textanzahl = 9;
int markergroesse=50;
int bildx = 250;
int bildy = 188;
int textzeile = 35;
PImage[] bilder = new PImage[bilderanzahl];
PFont schrift;
boolean start = true;

void setup() {
 size(bildx*2,bildy+textzeile);
 strokeWeight(3);
 noFill();
 smooth();
 for(int i=0; i<bilderanzahl; i++){
   String bildnummer= i + ".jpg";
   bilder[i] = loadImage(bildnummer);    
 }
}

void draw(){
 if (start == true){
   marker();
 }
 start = false;
}

void mousePressed(){
 marker();
}

void marker(){
 background(20);
 bildwahl();
 textwahl();
 stroke(255,0,0,150);
 float ellipsex1 = random(markergroesse/2,(width/2-markergroesse/2));
 float ellipsey1 = random(markergroesse/2,((height-textzeile)-markergroesse/2));
 float ellipsex2 = random(width/2+markergroesse/2,(width-markergroesse/2));
 float ellipsey2 = random(markergroesse/2,((height-textzeile)-markergroesse/2));
 ellipse(ellipsex1,ellipsey1,markergroesse,markergroesse);
 ellipse(ellipsex2,ellipsey2,markergroesse,markergroesse);
}

void bildwahl(){
 image(bilder[round(random(0,bilderanzahl-1))],0,0);
 image(bilder[round(random(0,bilderanzahl-1))],width/2,0);
}

void textwahl(){
 schrift = loadFont("Silkscreen-21.vlw");
 textFont(schrift, 21);
 fill(245);
 String randomtext;
 String[]  texte = new String[textanzahl];
 texte[0] = "transformieren"; //kontext
 texte[1] = "zusammen denken"; // material
 texte[2] = "analogie";
 texte[3] = "differenz";
 texte[4] = "prinzip";
 texte[5] = "semantik";
 texte[6] = "funktion";
 texte[7] = "form";
 texte[8] = "farbe";
 randomtext = texte [round(random(0,textanzahl-1))];
 textAlign(CENTER);
 text(randomtext, width/2, height-10);
 noFill();
}


do you know whats wrong?

cheers,
slex

(edited the subject)
Re: web applet fails to run
Reply #1 - Mar 7th, 2007, 6:56pm
 
a classical: 'read the f***ing manual' problem.

put the pictures not only in your sketch folder but into the data folder of your sketch - then export the applet.
you will see - there is no problem because there is already a solution


double cheers,
sebastian
Page Index Toggle Pages: 1