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 › ERROR: Type not found !
Page Index Toggle Pages: 1
ERROR: Type not found ! (Read 689 times)
ERROR: Type not found !
Apr 12th, 2007, 2:04am
 
Hi,

my name is Gustavo, I have been programming with Processing since 6 very exiting Month & I have, until now,  always been able to correct any kind of semantic ERROR.

I´ve created as always one class, named Waltzen, and it doesn´t seems to be acknowledged within the temporary files... hier the code. (A part of it)

PImage b;
int num = 3;
Waltzen[] waltzen = new Waltzen[num];
float [] vel= new float [num];
float acc=0;

void setup(){
 b = loadImage("w.jpg");
 size(400,1000);
 smooth();
}

//initializierung der Geschwindichkeiten auf vel=0, ypos auf 0
for(int i=0; i=num;i++ ){
 waltzen[i].vel=0;
 waltzen[i].ypos=0;
}

void draw(){  
 ypos();
 
 for(int i=0; i=num;i++){
   waltzen[i].vel -= acc;  
 }  
}

//*** hier is the class***//

class Waltzen{
 float vel;
 float xpos, ypos;
 
 Waltzen(PImage b){
   image(b, this.xpos, this.ypos);
 }
}

Thank you very much in forwards, I hope you may help me find the reason why it always apears this info at my editor:

tmp/build35349.tmp/Temporary_2334_7933.java:3:2:3:8: Semantic Error: Type "Waltzen" was not found.

Gustavo Vilera
Re: ERROR: Type not found !
Reply #1 - Apr 12th, 2007, 9:26am
 
Hi, there are some errors in your code. First the part:
Code:

//initializierung der Geschwindichkeiten auf vel=0, ypos auf 0
for(int i=0; i=num;i++ ){
waltzen[i].vel=0;
waltzen[i].ypos=0;
}


stands outside any method, this part should be put in the setup statement.

Second one: you call a the ypos() method in the draw function, but this method doesn't exists.

Also the way you use the for loop is a little bit unusual. Your num variable is 3. I think you would have 3 waltzen objects. But you will get 4 (0,1,2,3). So this part: i=num should look like: i<num.

In your class an image should drawn at the screen at the initialization. But the two coordinates are not overload.
I think you look for something like this:
Code:

class Waltzen{
float xpos, ypos, vel;
PImage img;
//initialize the Object and overload an image a the position
//waltzen[i]=new Waltzen(x,y,image)
Waltzen(float i_xpos, float i_ypos, PImage i_img){
xpos=i_xpos;
ypos=i_xpos;
img=i_img;
}

//call waltzen[i].draw() will draw the image to the screen
void draw(){
image(img, xpos, ypos);
}

At last you not need call this in a class to use its variables.
Re: ERROR: Type not found !
Reply #2 - Apr 12th, 2007, 8:58pm
 
Thanks a Lot !!
I realized Yesterday about the Errors in the FOR block, but I never came to the idea of putting a draw funtion in the Class. I now understand what the mistake was.
Only one more question, why it is that the same void draw in the class doesn´t repeats in a Loop?
Re: ERROR: Type not found !
Reply #3 - Apr 12th, 2007, 9:16pm
 
just because they are contained in a class. only functions on the local / global level of your sketch will be called by default.
Page Index Toggle Pages: 1