9 Replies Latest reply on Jun 27, 2007 9:14 PM by kglad

# measuring a map in flash

I'm looking to make a map of my local golf course in a flash application that can measure the distance between two points and have this program on my pocket pc. Can any one refer me to a tutorial that shows me how to do this? The image, for example 400px Wide x 150px Tall and that will be the equivilant distance of 600 yards x 250 yards (rough idea here) and I would like to place my stylus at one point then place it at another, with the distance showing in a dynamic text box. Thanks for any help!
• ###### 1. Re: measuring a map in flash
scale your flash map with 1 pixel = 1.5 yards of golf course.

draw your course, compute your distance in pixels, multiply by 1.5 and append the number with yards.
• ###### 2. Re: measuring a map in flash
Could you elaborate on how to compute distance in pixels?
• ###### 3. Re: measuring a map in flash
Use the Pythagorean theorem.
(a*a)+(b*b) = (c*c)

I made a quick script that is probably not as pretty as it could be, but measures the distance of your mouse from the center of the stage. You could modify it to set any value to that variable, and feed it to the function. The function is the meat of it, and the other is just a method of showing how it works.
• ###### 4. Re: measuring a map in flash
that's not correct. there should be no Math.abs() functions in your getDistance() function.
• ###### 5. Re: measuring a map in flash
You're Right K - you don't need the Abs.
• ###### 6. Re: measuring a map in flash
not only do you not need it, it's incorrect with it.