AS3: Make sure children stay inside the parent movie clip form

Red: Form inside the parent movie clip;
Yellow: Children inside the parent movie clip

Image http://frontenddev.com/images/stack.png

I would like to animate the yellow dots, but make sure they never go beyond the red border of the form. How can I approach this problem?

+3
source share
3 answers

Give it a try hitTestObject. It evaluates the display object to see if it intersects or intersects with the displayed object obj.

for each(var yellow:DisplayObject in yelloDotsArray)
{
  if(yellow.hitTestObject(theRed))
    trace("this dot is within the limits");
  else
    trace("this dot is outside the red area");
}
0
source

. .

, , , , , .

0

, outter ( ), - , , hitTestObject.

, , http://code.google.com/p/collisiondetectionkit.

0
source

Source: https://habr.com/ru/post/1737423/


All Articles