How can I use this arrray?

I have written arguemnts to add severals shapes to the scene(by using createVrmlFromString()), all the shape nodes stored in shapeArray[], now I'd like to use another array(b[]) to get the index of each shape nodes which has been added to the secne, so that I can record the their sequence.
1. Can I use the arguments as following:
shapeArray = {shape1,shape2,shape3.....}
if(clickedButton = shape1)
{ b.add(shapeArray.indexof(0)); b++ }
if (clickedButton = shape2)
{ b.add(shapeArray.indexof(1)); b++}
2. Since the length of b[] is dynamically changed according to the number that the nodes added to the scene, shoudl I use the vector, how can I get the index of the shapeArray to a vector. should I use
Vector b = new Vector;
b.addElement(shapeArray.indexof(0));
b++; //?

I haven't used createVrmlFromString(), but maybe this will help...
Note at Square, Circle, and Rectangle extends Shape.
Shape[] shapeArray = { new Square(0, 0, 10, 10),
                                 new Circle(10, 10, 10),
                                 new Rectangle(20, 20, 150, 100)
Vector clickedShapes = new Vector();
// in the combobox listener
clickedShapes.add(shapeArray(cb.getSelectedIndex()));
// in the 'submit button' actionlistener; get first item
Shape s = (Shape)v.get(0);
[/code[

Similar Messages

Maybe you are looking for