Skip to main content
Inspiring
August 16, 2016
Question

Detecting if location of the user is in a define area in AS3

  • August 16, 2016
  • 1 reply
  • 191 views

I've got 7 geolocations points (lat & long) that defines an area like this :

How can I trigger a function when the user is in the area ?

I thought about something like :

if(e.latitude < -20.280442 && e.latitude > -21.414927 && e.longitude < 167.738801 && e.longitude> 166.739045){

do something

}

With this method I'm defining a square (2 latitude points and 2 longitude points).

Do you see another way to do it more precisely ?

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
August 16, 2016

You should be able to create a shape, make its alpha property 0, and then perform hittests to see if the user object is touching that shape.