-
Ok, I have made a function to change the color (combineRGB), it works well with the following stuff, changing the color of "ball1"
ball1Color = new Color ( "ball1" );
ball1Color.setRGB (combineRGB ( 201, 0, 0 ));
but now I want to change the color of "ballx" (x = int)
x = 1;
theName = eval ( "ball" + x)
objectColor = eval ( theName + "Color" );
objectColor = new Color ( theName );
objectColor.setRGB (combineRGB ( 201, 0, 0 ));
why doesnt it work?
whats wrong?
thx
-
What exactly isn't working?
the only thing wrong that i can find is this:
objectColor = eval ( theName + "Color" );
it doesnt do anything since the next line overwrites the content in objectColor:
objectColor = new Color ( theName );
/Mirandir
-
this one is working:
ball1Color = new Color ( "ball1" );
ball1Color.setRGB (combineRGB ( 201, 0, 0 ));
the other stuff doesnt work
-
ok, thx, I corrected it and it works now
looks like this now:
x = 1;
object = eval ( "ball" + x)
object.objectColor = new Color ( object );
object.objectColor.setRGB (combineRGB ( 201, 0, 0 ));
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|