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.
Page Index Toggle Pages: 1
Name as Path (Read 491 times)
Name as Path
Aug 2nd, 2007, 3:06am
 
Hi, i've just began using processing a month ago, but all my knologe about programin is based on flash, wich is fine, and now i 'm tryng to do something easy on flash that a can't find a way to do it on processing.

i wan to use a variable as a path for an object.

in flash would be like this...

for(i=0;i<5;i++){
   _root["obj"+i]._alpha=50;
}

so my movieclip obj1,,,obj5 would change!

but i dont know how to do this with processing...

thanks!
Re: Name as Path
Reply #1 - Aug 2nd, 2007, 7:07am
 
there is no way i know of to dynamicly call objects like that .. and to be honest it's not the nicest thing to do in flash too since it makes your code harder to read.

you can do something similar (looping thru objects) by keeping an array of your objects:

Code:

String[] arr = new String[]{
"a",
"b",
"c"
};
for ( int i = 0; i < arr.length; i++ )
{
println( arr[i] );
}


F
Page Index Toggle Pages: 1