I have a wheel of fortune style wheel that I created flash and exported as a flex component. When the wheel stops spinning, the Wheel.as class dispatches a text event telling me which wedge of the wheel it stopped on. Unfortunately, the hit test always returns fails in the following code:
var i:int = 0;
while(i < 16 && !getWedgePointer("spinnerWedge" + (i+1)).hitTestPoint(215.3, 10, true))
trace("spinnerWedge" + (i+1), getWedgePointer("spinnerWedge" + (i+1)).hitTestPoint(215.3, 10, true));
I've drawn a small circle in the Wheel class at those same coordinates, and I can see that it does intersect with the wheel. Any ideas why hitTestPoint continues to fail?
HitTestPoint requires global coordinates.
Got it working! Ya, that's all it took was to use global points.
var myPointForHitTest:Point = localToGlobal(new Point(215.3, 10));
spinerWedge.hitTestPoint(myPointForHitTest:Point.x, myPointForHitTest:Point.y, true);