• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Contributor ,
Aug 15, 2016 Aug 15, 2016

Copy link to clipboard

Copied

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

ilot canard.png

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 ?

TOPICS
ActionScript

Views

149

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 16, 2016 Aug 16, 2016

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines