CongoZombie wrote on Aug 2nd, 2008, 3:35am:Try putting the array section in either the setup function or the draw loop.
As far as I know, if you use a setup and draw loop you can't use code that is outside of the loops (except variable declarations etc.)
Okay, I try this:
---------------------------------
int h = 400;
int w = 400;
void setup() {
size ( h,w);
background ( 250, 250, 205);
stroke( 100, 203, 12 );
float[] points = new float[10];
for ( int i = 0; i < 10; i++ ) {
points[i] = i * 3;
}
}
void draw() {
for ( i = 0; i < 10; i++ ) {
// ellipse(points[i], 104, 4, 4);
ellipse( i * 9, 55, 23, 43); // testing
}
}
------------------------------
And I get the error
Semantic Error: No accessible field named "i" was found in type "Temporary_856_5281".
I heard somewhere along the line that anything created in setup is not available later on. That seems to be true, since I set i in the setup, and the error gets thrown in the draw() loop.
So, I apparently can't create an array in setup() that I would want to use in draw(), because it gets destroyed. However, I don't want to create it in draw(), because I'm looping, and I only want to create the array once, and I *do* eventually want to use the looping feature of draw().
So the only logical place to put the creation of the array would be outside of both setup() and loop(), AFAICT.