I am currently trying to assign an event handler to dynamically created rectangle objects.
These objects are created in a loop based on data within an array e.g.
for(int a = 0; a < array.getlength(0); a++)
{
//draw rectangle on each iteration
rectangle shape = new rectangle();
shape.width(200);
shape.height(50);
shape.posTop(posx);
shape.posLeft(posy);
posx = posx + 20;
posy = posy + 50;
//code to draw onto Canvas object etc...
}
is there anyway to assign a mouse click event to each iteration of this object so I can retrieve information about each?
Have you tried it with something like this
When I remember right shapes have no click event, but other mouse events like mousedown.