Skip to main content
Participant
September 28, 2011
Question

Calculating a distance between 2 movie clips?

  • September 28, 2011
  • 1 reply
  • 305 views

I have two movie clips. One is simply on the screen, meaning it can be referred to as _root.movieclip1. The other is within another movie clip, like _root.movieclip2.movieclip3. How do I calculate the distance between the movieclips 1 and 3? The third's coordinates are shown not as they would be on stage, but from inside the second movie clip. I'm using Macromedia Flash Professional 8.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
September 28, 2011

you can use localToGlobal() or, because this is such a simple nesting, just use:

var mc3X:Number=_root.movieclip2._x+_root.movieclip2.movieclip3._x;

etc