I've been trying to use OO in Gideros. So I created a "bubble" class from Bitmap as my sprite class, and created a local var "id" in the class.
I then used a for loop to generate an array of bubbles and stored an id to each bubble.
In the bubble class, when I called print(id) on touch/mouse event, it triggered every bubble's event function, and also returned the same id for every bubble.
Eg: (unnecessary code removed)
GCbubble = gideros.class(Bitmap)
local myId = 0;
for i=1, cols*rows, 1 do
If the loop generates10 bubbles and I touch any 1 of them, i get "10" printed 10 times due to each bubble triggering the function.
Any way I can only make the touched bubble return its id?