In this section
you'll get some small movie clips which can be used in your flash
projects with flash components, flash action scripts .as files and
some other stuff that will help you in your flash projects. You
can also submit your work here. For submit details please checkout
our Submit Page.
Make two movie clips and place them on the stage.
Give some instance names to your movie clips. Here
i have used mc1 and mc2. Now use following script
to calculate distance between these two movie clips.
dis1 = _root.mca;
dis2 = _root.mcb; // Difference bet. 2 movie clips using Pythagorean Theorem
diff = Math.sqrt(((mc1._x - mc2._x) * (mc1._x - mc2._x)) + ((mc1._y - mc2._y) * (mc1._y - mc2._y))); // To get distance as integer add this line.
diff = Math.round(diff);
trace(diff);