I've tried to fix your capx, and here's what I came up to link.
I works a bit better.. a tiny bit:( Still needs fixing.
May be you'll find a way to make it run as intended:)
I'll keep trying too, and I'll let you know if I find a solution ^_^
UPD: Allright, I've tried another way and kinda got it running:) Example 1
So.. the answer is.. Tilemaps! :D God I love them.
In this particular case, using a single tilemap replaces both Array and Sprites
and saves us from some pain-in-the-butt with our code.
Well my example works pretty fine, I guess.
But! It now deletes only those tiles that are in the same row/col with the tile we click.
And I think we need to check if every tile we delete has 3matching tiles..
Sorry, hard to explain, I hope you get the idea:)
To do this, we need a simple recursion.. but seems it's not working :((( Or I'm just doing something wrong :P
Please let me know if you find how to fix it!