Skip to main content
Inspiring
August 16, 2016
質問

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

  • August 16, 2016
  • 返信数 1.
  • 191 ビュー

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 ?

このトピックへの返信は締め切られました。

返信数 1

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.