-
8 May 2012 1:50 AM #1
Group ID of sprite
Group ID of sprite
Scenario:
I have a large number of sprites drawn on a surface. Some are paths and others are groups of sprites at certain points along the path.
When I mouse click or over a group, I capture the event on a sprite within that group however I cannot get the name/id of the group that that sprite belongs to.
If I use firebug to look at the groups within the surface, I can find see all the groups and the sprites contained in each group.
Currently, a workaround is to duplicate the group attribute with something like { groupid: "grp4", group: "grp4" }
Am I doing something wrong? I do not want to have to go through around 400 sprites and add this groupid attribute.
-
8 May 2012 4:51 AM #2
Unfortunately, you will need to duplicate the group ID. The other (slower) option is to search the surface's groups group to check where the sprite was added. Obviously, this is not very efficient.
See my comments in another thread toward the bottom. Here's the link.
EDIT:
I don't understand why the groups object is a CompositeSprite. This object contains other groups (not sprites), so it would be sufficient it was an an instance of MixedCollection, not CompositeSprite.
-
8 May 2012 5:15 AM #3
LesJ,
thanks for your response...took the easier route of adding groupid.
Everything works as intended now.
Cheers.
-
8 May 2012 8:23 AM #4
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote