ActionRange Class
An ActionRange defines a circle around a certain Location.
Events are fired as soon as the user enters or leaves this
circle.
var location1 = new AR.GeoLocation(47.77317, 13.069929); var actionRange = new AR.ActionRange(location1, 500); var location2 = new AR.GeoLocation(48.77317, 13.069929); var inArea1 = actionRange.isInArea(location1); //inArea1 = true var inArea2 = actionRange.isInArea(location2); //inArea2 = false
On creation, setup parameters can be passed to customize the properties of
the ImageDrawable.
var actionRange2 = new AR.ActionRange(location1, 500, { onEnter : function() { actionRange2.enabled = false; //an ActionArea which can only be entered once } });
Constructor
Item Index
Properties
Methods
destroy
()
Destroys the object.
isInArea
-
geoLocation
checks if a certain location is within this ActionArea.
Parameters:
-
geoLocation
GeoLocationthe GeoLocation that should be checked.
Returns:
true if the geoLocation passed to the method is within the ActionArea, false if the geoLocation passed to the method is not in the ActionArea
Properties
enabled
Boolean
Flag to enable/disable the ActionArea. If the ActionArea is disabled, triggers on this ActionArea will never be fired. In case it is enabled, it can fire triggers.
positionX
Number
deprecated
Specifies the position of the left edge of the radar background image. The value must be between 0 and 1. A value of 0 places the left edge of the radar background image on the left edge of the screen, 0.5 places the left edge horizontally in the middle of the screen.
positionY
Number
deprecated
Specifies the position of the top edge of the radar background image. The value must be between 0 and 1. A value of 0 places the top edge of the radar background image on the top edge of the screen, 0.5 places the top edge vertically in the middle of the screen.
width
Number
deprecated
Specifies the width of the radar background image, in percent of the portrait screen width.
The value must be between 0 and 1. A value of 0.1 sizes the radar background image in a way that
the width of the image makes up 10% of the entire screen width.
The aspect ratio of the radar background image will not be changed, the height of the radar will
thus be automatically calculated.
Events
onEnter
The trigger is executed when the user enters the
ActionArea.
The trigger is null by default, and will thus result in no action executed when the trigger fires. A developer can add custom functionality by assigning a custom function to onEnter.
onExit
The trigger is executed when the user leaves the
ActionArea.
The trigger is null by default, and will thus result in no action executed when the trigger fires. A developer can add custom functionality by assigning a custom function to onExit.