Blogroll

This blog is created for education about engineering students.All the engineering students are get free downloadable books here. not only books and also different software also available here

16. Calculating the Distance Between the Two Points

16. Calculating the Distance Between the Two Points


Procedure:
step 1: Open flash 8
step 2: Select flash document
step 3: select 1st layer, 1st frame on that document and write source code on Actions Frame
step 4: To check output press ctrl+enter(test movie)

Source code:



function getDistance(x0,y0,x1,y1)
{
var dx=x1-x0;
var dy=y1-y0;
var sqr=Math.pow(dx,2)+Math.pow(dy,2);
return (Math.sqrt(sqr));
}
var a=15,b=26,c=18,d=30;
trace("The distance between ("+a+","+b+") and ("+c+","+d+")     points        is:"+getDistance(a,b,c,d));

No comments:

Post a Comment

Total Pageviews