Hi,
Thank you for your enquiry.
To keep track of multiple cloned objects, it is a good idea to ensure that the object name given to the clone is unique. For example, say you have created a variable named 'num' with a default value of 0, and have then applied the following script actions to a button:
Code:
eval("clone" + num + "= Circle.CloneObject()")
num++
The first time the above script is run, it will create a clone of the object 'Circle' and this clone will be given the name 'clone0' (i.e; the string 'clone' plus the current value of the 'num' variable).
As the 'num' variable is increased, the next time these actions are called, the new clone will be called 'clone1' and we can easily differentiate this from the original clone. For example, the following code:
Code:
clone0.DestroyCloneObject()
will destroy the first clone created, but leave all subsequent clones unaffected.
Please find below a link to download a sample publication which expands on this idea. This publication contains three dropzones which each have their own array (a[], b[] and c[]). Each time a cloned object is dropped into one of these dropzones, the name of the clone is stored to the relevant dropzone array and the 'num' variable is increased.
I have then added a button next to each dropzone which use a for...next loop to destroy each of the cloned objects in the adjacent dropzone's array, without affecting any of the clones which have been dropped on the other two dropzones.
I hope this helps. Please do not hesitate to contact me if you have any further queries.
Kind regards,