Getting a child's real coordinates

When trying to get coordinates from a child object through it’s parent, the results are in relation to it’s parent. But what if I wanted these coordinates in relation to the stage?

You thinking backwards. you need to redesign your code, so you can look from the outside in not the other way around.

Maybe my exmaple was misleading…

In my case I am “looking from the outside in”. In my document class (stage) I’m trying to get properties from a child’s child. I understand senocular’s post but it doesnt really relate to what im doing.

stage.childsName.otherChild.x

Why can’t you use that then?

[QUOTE=ajcates;2326487]stage.childsName.otherChild.x

Why can’t you use that then?[/QUOTE]

I can, but that will give me “otherChild”'s x position in relation to “childsName”. For example if I did:

stage.addChild(Dad);
Dad.x = 100;
Dad.y = 100;
Dad.addChild(son);
trace (Dad.son.x);

It would return 0 even though it’s position will technically be 100.

You can use localToGlobal().

I’m not sure how it works exactly so you better check it out yourself.
Search the Flash Help.

root.addChild(Dad);
Dad.x = 100;
Dad.y = 100;
Dad.addChild(son);
var point:Point=new Point(son.x,son.y);
trace (Dad.localToGlobal(point));

if you need to do that, then that child needs to be in the stage, not on that movieclip.

What u mean by that?
I used this for finding stage boundaries and it’s working perfectly on every clip which hes reference to stage

Thanks all, that’s what I was looking for.

woah nice
i like that

root.addChild(Dad);
Dad.x = 100;
Dad.y = 100;
Dad.addChild(son);
var point:Point=new Point(son.x,son.y);
trace (Dad.localToGlobal(point));