A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] [Resolved] Distance Bet

  1. #1
    How can I get the distance btween two MCs?


  2. #2
    Senior Member
    Join Date
    Jan 2002
    Posts
    368
    first get the distance between their _x's, then the distance between their _y's. this can be used to draw a right triangle in which the hypotenuse is the line between the two mcs. using some elementary trig/geometry, we know that the square of the hyp. is equal to the sum of the squares of the two sides, so...


    dx=mc1._x-mc2._x;
    dy=mc1._y-mc2._y;
    dist=Math.sqrt(dx*dx+dy*dy);

  3. #3

    reply

    Cool It worked Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center