Wednesday, June 20, 2012

[Action Script] Object inside another Object -> problem with HitTestPoint June,2012

Hi guys,

I have a map in which I placed an object.
The map is a movie clip, so after duble click on it I am "inside" this movieclip.
As I am inside I draw a rectangular shape -> transformed into movieclip and called "bumper_mc".

Why my HitTestPoint does not work?

trace(bumper_mc.x + " -> "+mouseX);
trace(bumper_mc.y + " -> "+mouseY);
trace(bumper_mc.hitTestPoint(mouseX,mouseY));
if(bumper_mc.hitTestPoint(mouseX,mouseY,true))
{
trace("HIT");
}
else
{
trace("MISS");
}

Above code works for the situation when Object stands alone -> I mean when "bumper" is not "inside" the map.

Both objects are visible during simulation. "Bumper" lays on the map.


Additional comment:
trace(bumper_mc.x + " -> "+mouseX);
trace(bumper_mc.y + " -> "+mouseY);
Shows exactly the same coordinates despite the fact wheter the "Bumper" is inside or outside the object "map", but function works properly only for the case when "Bumper" is alone.
Object inside another Object -> problem with HitTestPoint

Related Post



0 comments: