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
Increment (Read 641 times)
Increment
Dec 12th, 2006, 5:15am
 
Hello,

How to increment step by step an index of array?
This array, is an array of object.
For each creation of an object, I want to be able
to increment this by one...and give it (to object)
parameters.

thank,
solipse.
Re: Increment
Reply #1 - Dec 21st, 2006, 1:50pm
 
You could use vectors instead (more flexible class). But if you need arrays, try redimensioning arrays

Something like this():

Quote:


Object[] resizeArray(Object[] oldArray, int newSize){

   Object[] newArray=new Object[newSize];
   System.arraycopy(oldArray,0,newArray,0,(oldArray.length<newSize oldArray.length : newSize));
   return newArray;
}


One Saludo.
Nach.
Page Index Toggle Pages: 1