Say you have a movieClip called "A_mc" on the stage that you move to
x:20 y:20, then you have a movieClip in "A_mc" called "B_mc" that you
place at x:20 y:20.
When looking at the stage "A_mc" will be at x:20 y:20, but "B_mc" will
be at x:40 y:40.
However, if you ask what B_mc._x is then it will say 20 because it
relates it to it's parent movieClips registration point(x:0 y:0).
So to find out when "B_mc" actually is on the stage you use:
var myPoint:Object = {x:B_mc._x, y:B_mc._y}
B_mc.localToGlobal(myPoint);
Trace("myPoint is now relative to the Stage: (" + myPoint.x + ":" +
myPoint.y + ")");
So, in your case you would say:
var myPoint:Object = {x:MAP.springfield._x, y:MAP.springfield._y}
MAP.springfield.localToGlobal(myPoint);
Trace("myPoint is now relative to the Stage: (" + myPoint.x + ":" +
myPoint.y + ")");
Hope that help you "get" it.
Giles
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kurt
Dommermuth
Sent: 07 October 2005 11:39
To: [email protected]
Subject: [Flashcoders] localToGlobal ?
Hello,
How localToGlobal is to be used has confounded me from day 1. I never
"get" it and usually end up doing things in some assbackwards way to
accomplish what I want.
Hopefully someone can put me out of my misery once and for all.
at least in terms of localToGlobal.
I have a an MC called MAP . Within MAP I mark certain towns with nested
movie clips with unique names such as "springfield".
I want to pass a function located in _root the _x and _y values of
"springfield" and have the map move so "springfield" is in the center of
the stage.
I know this should be a simple task and yet I waste hours every time I'm
faced with this type of problem.
Hope I'm being clear.
thank you!
Kurt
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders