I need to create and destroy a group of objects the number of which varies at runtime. So, for instance, when the user clicks menuItem1, let's say I need 5 of these objects. Then when the user clicks another menuItem, I need to destroy the 5 existing objects and create, say, 3 new ones.
So, my question is: how do I write a variable declaration to accomodate this process. For instance, let's say I need objects:
object1 = new myObject(args)
object2 = new myObject(args)
object3 = new myObject(args)
object4 = new myObject(args)
object5 = new myObject(args)
Is there some way I can write a for loop to create these objects and give them the names above? If I could do this, then I could destroy them easily enough when I need to. (By the way, what happens to the variables when the objects they are associated with are destroyed?)
Thanks,
JAS
So, my question is: how do I write a variable declaration to accomodate this process. For instance, let's say I need objects:
object1 = new myObject(args)
object2 = new myObject(args)
object3 = new myObject(args)
object4 = new myObject(args)
object5 = new myObject(args)
Is there some way I can write a for loop to create these objects and give them the names above? If I could do this, then I could destroy them easily enough when I need to. (By the way, what happens to the variables when the objects they are associated with are destroyed?)
Thanks,
JAS