# I am going crazy (localToGlobal)

**URL:** <https://forum.kirupa.com/t/i-am-going-crazy-localtoglobal/281266>\
**Category:** flash\
**Created:** [February 6, 2009, 6:05pm UTC](https://forum.kirupa.com/t/i-am-going-crazy-localtoglobal/281266 "2009-02-06T18:05:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![malidia](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/malidia/32/684_2.png) [@malidia](https://forum.kirupa.com/u/malidia)\
**Post date:** [February 6, 2009, 6:05pm UTC](https://forum.kirupa.com/t/i-am-going-crazy-localtoglobal/281266/1 "2009-02-06T18:05:52Z")

</div>

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:

```auto

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:

```auto

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](http://troyblank.com/temp/hitTestScreen.gif)

Here is FLA source:  
[http://troyblank.com/temp/HitTest.zip](http://troyblank.com/temp/HitTest.zip)
