# localToGlobal and globalToLocal question

**URL:** <https://forum.kirupa.com/t/localtoglobal-and-globaltolocal-question/315498>\
**Category:** flash\
**Created:** [October 27, 2010, 7:24pm UTC](https://forum.kirupa.com/t/localtoglobal-and-globaltolocal-question/315498 "2010-10-27T19:24:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luka66\_6](https://avatars.discourse-cdn.com/v4/letter/l/a9a28c/32.png) [@luka66\_6](https://forum.kirupa.com/u/luka66_6)\
**Post date:** [October 27, 2010, 7:24pm UTC](https://forum.kirupa.com/t/localtoglobal-and-globaltolocal-question/315498/1 "2010-10-27T19:24:32Z")

</div>

Hi

I have a small problem with usage localToGlobal and than back to local. I can get global coordinate of my nested mc in question alright. Than i check if this coordinate + value of my mc.width is more than my stage width. I get to this part with no problem. Than if value is bigger (so mc is not on the stage i mean if part is off the stage i change value so it is stage width - mc.width). So i get value in global coordinates that i need.  
\*\*But how do i apply this to my nested clip is my question? \*\*  
For reference here is my code:

```php
     var localPointX = comet.comet_mc.cometText_mc.x;
     var localPointY = comet.comet_mc.cometText_mc.y;
     var localPoint:Point = new Point(localPointX, localPointY);

     var globalPoint:Point = comet.comet_mc.cometText_mc.localToGlobal(localPoint);
     var globalPointX = globalPoint.x;
     var globalPointY = globalPoint.y;

    if(globalPointX + comet.comet_mc.cometText_mc.width > stage.stageWidth)
    {
         var newCoordinate = stage.stageWidth - comet.comet_mc.cometText_mc.width - 20;
         trace(newCoordinate);
    }

```

I just need i litle push in right direction, how to apply this new global x that i get locally to my clip.

tnx

Luka
