# localToGlobal scope

**URL:** https://forum.kirupa.com/t/localtoglobal-scope/206164
**Category:** Uncategorized
**Created:** [November 6, 2006, 12:37am UTC](https://forum.kirupa.com/t/localtoglobal-scope/206164 "2006-11-06T00:37:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![newbie\_geek](https://avatars.discourse-cdn.com/v4/letter/n/d9b06d/32.png) [@newbie\_geek](https://forum.kirupa.com/u/newbie_geek)
#### Post date: [November 6, 2006, 12:37am UTC](https://forum.kirupa.com/t/localtoglobal-scope/206164/1 "2006-11-06T00:37:40Z")

</div>

hey all, i am teaching myself how to use localToGlobal(), and i seem to be running into a scoping snag, at least i THINK it is a scoping snag.

So when i use

```auto
onClipEvent(mouseUp){
	pnt=new Object()
	pnt.x = _x
	pnt.y = _y
	_parent.localToGlobal(pnt)
	trace ("dragSq,x : "+pnt.x);
}

```

i get the desired effect, yippee. That is to say, the output says 299, which is what the global coordinate of the movie is.

However when i try use the same code in the main time line like this

```auto
x_map.x_3.onRelease = dragSQ;

function dragSQ(){
	dragSq=new Object()
	dragSq.x = _x
	dragSq.y = _y
	_parent.localToGlobal(dragSq)
	trace ("dragSq.x from ROOT is : "+dragSq.x);
}

```

i get 0 as an output. This tells me something is broke!

What is broke? Any suggestions would be great. Thanks.
