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 › Applet notloaded
Page Index Toggle Pages: 1
Applet notloaded (Read 881 times)
Applet notloaded
May 6th, 2009, 1:13pm
 
Hi all,

So I've exported and uploaded my first sketch:

[I'd give you the link here, but apparently I can't.]

but it doesn't load. Literally, just says "Applet notloaded" in the message bar, and the Console is blank. The .jar runs just fine here on my desktop, and Java appears to be updated to the latest version. No other problems, Firefox or Safari, with other Java progs. Anyone have any ideas?

edit: also, the .jar file doesn't load when I open the .html (via Export) from my desktop.

edit: Just saved the original sketch under a different file name and re-exported it, but now the error message tells me that the jar that isn't loading has the original file name.

Here's the code:

Code:
PImage wall;
PImage flr;
PImage head;
PImage body;
PImage wheel;
PImage light;
PImage yellowlight;
PImage bluelight;

int pos;
float v, a;
float tempScl, scl;
float t;
float headtrans;
int k=1;
float decay=1.0;
int d;
float alive=1;
boolean buttonOver=false;

Decay dec;

void setup() {
size(720,300);
imageMode(CENTER);
wall=loadImage("wall.png");
flr=loadImage("floor.png");
head=loadImage("head.png");
body=loadImage("body.png");
wheel=loadImage("wheel.png");
light=loadImage("light.png");
yellowlight=loadImage("yellowlight.png");
bluelight=loadImage("bluelight.png");

dec=new Decay();
dec.doit();

noStroke();
}

void draw() {
int rand=int(random(-2,2));
float noiseScale=noise(random(10))*0.01*rand;

//decay
decay*=0.99975+noiseScale;
if(decay<=0.75) {
alive*=0.995;
}

//scale
t+=0.05*alive;
tempScl=sin(t);
float tempMap=tempScl*decay;
scl=map(tempMap,-1.0,1.0,0.95,1.05);

// location, speed
if(50+pos<=10) {
v=0;
decay=1.0;
}
else {
v=0.5+sin(t-1);
}
a=0.1;
if(v>=0) {
v+=a*k*decay*alive;
pos+=v*k*decay*alive;
}

image(wall,360,150);

image(yellowlight,315,60);
image(bluelight,405,60);

// head
pushMatrix();
pushMatrix();
if(v<=0) {
headtrans=k*decay*alive;
}
else {
headtrans-=0.2*v*k*decay*alive;
}
translate(160+pos,155+headtrans);
image(head,0,0);
popMatrix();

// body
pushMatrix();
translate(50+pos,148);
scale(scl);
image(body,0,0);
popMatrix();

popMatrix();

if(k==-1) {
image(light,30,200);
}

// wheel
pushMatrix();
float wrot=PI*(pos*0.01);
translate(50+pos,186);
rotate(wrot);
image(wheel,0,0);
popMatrix();

image(flr,360,276);
}

void keyPressed() {
if(key==' ') {
if(k==1) {
k=-1;
}
}
}

void keyReleased() {
k=1;
}

void mousePressed()
{
if(buttonOver) {
link("http://www.jpmorgan.com/pages/jpmorgan/private_banking", "_new");
}
}

void mouseMoved() {
checkButtons();
}

void mouseDragged() {
checkButtons();
}

void checkButtons() {
if(mouseX > 275 && mouseX < 355 &&
mouseY > 20 && mouseY <100) {
buttonOver = true;
}
else {
buttonOver = false;
}
}


/************************************************/
/*************** THE END OF HISTORY *************/
/************************************************/

class Decay {
int deccall;
String URL="http://www.google.com/finance?/finance?q=INDEXDJX:.DJI";
String tempstring;
String[] data;

Decay() {
}

void doit() {
data=loadStrings(URL);

for(int i=0; i<data.length; i++) {
int t=data[i].indexOf("<span class=\"chg\" id=\"ref_983582_cp\">(");
if(t>-1) {
tempstring=data[i].substring(t+39,t+42);
}
}

float newquote=float(tempstring)/10;
println(newquote);
}
}
Re: Applet notloaded
Reply #1 - May 7th, 2009, 7:18am
 
I am not sure if that's the problem, but an applet loading data from another site than the one hosting it must be signed to work.
You can also check the Java console for messages.
Page Index Toggle Pages: 1