Skip to main content
Participant
August 17, 2014
Question

how do i get hitTestObject working on all objects in a sprite container so that they are removed from the stage individually when bumped into by another object?

  • August 17, 2014
  • 1 reply
  • 176 views

hitTestObject only detects hits on one of the objects in a container, and how do I go about removing the objects from the stage?

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
August 17, 2014

If you check each object in the sprite for a hitTest using a loop then you should get what you want.  If the only child objects in the sprite are the ones you bump into then you could just loop thru them using the numChildren property of the sprite and getChildAt() method.  Otherwise, if there are other objects ion the sprite that you do not want to include then you might either need to use an array to identify the hittable objects or have some way of differentiating them for the looped hitTests.