Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Jan 2010
    Location
    Northern Ireland
    Posts
    58
    Vote Rating
    2
    Frith is on a distinguished road

      0  

    Default 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.

  2. #2
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,329
    Vote Rating
    118
    LesJ is a name known to all LesJ is a name known to all LesJ is a name known to all LesJ is a name known to all LesJ is a name known to all LesJ is a name known to all

      0  

    Default


    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.

  3. #3
    Sencha User
    Join Date
    Jan 2010
    Location
    Northern Ireland
    Posts
    58
    Vote Rating
    2
    Frith is on a distinguished road

      0  

    Default


    LesJ,
    thanks for your response...took the easier route of adding groupid.

    Everything works as intended now.

    Cheers.

  4. #4
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,329
    Vote Rating
    118
    LesJ is a name known to all LesJ is a name known to all LesJ is a name known to all LesJ is a name known to all LesJ is a name known to all LesJ is a name known to all

      0  

    Default


    Quote Originally Posted by Frith View Post
    LesJ,
    thanks for your response...took the easier route of adding groupid.

    Everything works as intended now.

    Cheers.
    Another option is to override the Surface.onAdd method and comment out this line:

    delete sprite.group;

    I didn't try it, but I think this simple change might work for you.

Thread Participants: 1