Reply To: Haversine Formula in Max – Troublesome.


Forums > Javascript > Haversine Formula in Max – Troublesome.
March 5, 2014 | 7:05 pm

Your lat1/lat2/lon1/lon2 variables are local to their functions, so other functions don’t know about them. You could declare them at the top of your code and then set them in your bang function, or you could get rid of these functions altogether and use declareattribute(). You can read more about declareattribute() here:

http://cycling74.com/docs/max5/vignettes/js/jsglobal.html

-Ben