Ok so I understand localToGlobal, i have used localToGlobal, but for some reason i can not get localToGlobal to work on a particular problem, and I am not sure why.
Here is my code:
package{
import flash.display.*;
import flash.geom.*;
import flash.events.MouseEvent;
public class HitTest extends MovieClip{
public function HitTest():void{
var hit:Boolean = false;
var floor:MovieClip = MovieClip(cont_mc.square_mc.parent);
var point:Point = new Point(floor.point_mc.x, floor.point_mc.y);
trace("point inside floor: "+point);
floor.localToGlobal(point);
var hT:Boolean = cont_mc.square_mc.hitTestPoint(point.x, point.y);
trace("point relative to Stage: "+point);
trace("does it hit the gray square?: "+hT);
}
}
}
traces:
point inside floor: (x=100, y=100)
point relative to Stage: (x=100, y=100)
does it hit the gray square?: true
nevermind the floor var i know it’s not needed, but anyway i have cont_mc on stage with a center point of about 300x and 100y, and inside i place square_mc to left of the center and point_mc to the right so they are not touching, but hit test says they do hit and the globalToLocal is not doing anything??? i am sure it’s something dumb i am doing, i just need a slap in the face :crying:
see image:
http://troyblank.com/temp/hitTestScreen.gif
Here is FLA source:
http://troyblank.com/temp/HitTest.zip