Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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?

New Here ,
Aug 17, 2014 Aug 17, 2014

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

TOPICS
ActionScript
158
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 17, 2014 Aug 17, 2014
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines