you should know the clicked object and after that Array.indexOf(obj).
Or you can add objects by type on Canvas and add click event.
Your problem is a bit odd. Usually we need an object, not an array there is a link to it.
Can event.target bring that kind of information?
1 person found this helpful
event.target - is an object you've clicked.
As a variant you can add a link to array in one of the object's property...
Hi Natasha. Thanks a lot for your attention.
Do you mind to further explain how can I add a link to an array from one of my objects (rectangles and circles) properties? I apology for my ignorance at that.
There are two variants:
1. Create a Dictionary (see docs for more info) to get an array by object.
So you need to add each object and an array.
dict[rect1] = myRectsArray;
dict[tr1] = myTrArray;
var arr:Array = dict[event.target];
Something like this.
2. Create an extended Rectangle to save any data you need.
I think the first variant is better.