Flash Tutorials, Samples, Resources, Greetings, Games
Home | About Us | Resources | Tutorials | Links | Games | Movies | Projects | Feedback | Contact Us
Tutorials
Here you'll get tutorials for all skill levels wheather you are a new user or an expert flash developer.

» Enter
Resources
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.

» Enter
Games
Play and download great flash games. If you have any flash game, please send us, we will put it with your name.

» Enter
Movies
Flash FLA movies to download.

» Enter
Home » Resources



   Action Scripts - Distance bet. 2 Movie Clips
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);