# hitTestPoint with localToGlobal not working and not sure why, argh!

**URL:** <https://forum.kirupa.com/t/hittestpoint-with-localtoglobal-not-working-and-not-sure-why-argh/322921>\
**Category:** flash\
**Created:** [June 8, 2011, 6:32pm UTC](https://forum.kirupa.com/t/hittestpoint-with-localtoglobal-not-working-and-not-sure-why-argh/322921 "2011-06-08T18:32:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SammyTheBear](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@SammyTheBear](https://forum.kirupa.com/u/SammyTheBear)\
**Post date:** [June 8, 2011, 6:32pm UTC](https://forum.kirupa.com/t/hittestpoint-with-localtoglobal-not-working-and-not-sure-why-argh/322921/1 "2011-06-08T18:32:03Z")

</div>

Hello all!

I am creating a chart with hitTestPoint in it. I have 7 MovieClips. 1 is the point that moves around on the chart and it is to “hit” 1 of the other 6 that make the chart. I am not too sure how to use hitTestPoint but I used hitTestObject and it worked, but I don’t want to use the bounding box so I decided to use hitTestPoint. My problem I think is the X and Y coordinates. I am not too sure which X Y to use and how they are used. Any help would be great. The chart is inside a MovieClip and the Dot is added to it. The chart is made up of MovieClips (6) that make up a square.

Here is my code:

function hitChart()  
{

hitDot.x = 25;  
hitDot.y = -130;

chartMC.addChild(hitDot);

if (hitDot.x \> 183)  
{  
hitDot.x = 183;  
}

if (hitDot.y \< -183)  
{  
hitDot.y = -183;  
}

var tpoint:Point = localToGlobal(new Point(hitDot.x,hitDot.y));

if(chartMC.ChartSection1.hitTestPoint(tpoint.x, tpoint.y, true))  
{  
myColor1 = chartMC.ChartSection1.transform.colorTransform;  
myColor1.color = parseInt(slideCounter.chartHitOn);  
chartMC.ChartSection1.transform.colorTransform = myColor1;  
}  
else  
{  
myColor1 = chartMC.ChartSection1.transform.colorTransform;  
myColor1.color = parseInt(slideCounter.chartHitOff);  
chartMC.ChartSection1.transform.colorTransform = myColor1;  
}  
}  
hitChart();
