Locations of visitors to this page


Add points on the map.

This example shows you how to use the geomovieclip component for adding animated movieclips on top of the map. Geomovie clip can load feature data from your server and place movieclips on the map. But it can also be used to let user add movieclips on that same map.

Make a map as usual and drag a geomovieclip on the stage. Set the following parameters as follow.

behaviorOnEvent : Reposition

fieldMovieclip : Add a movieclip name here in this case we make a movieclip called 'mypoint'

targetInstance: my_map (the instance name of the movieclip)

Add a button on the stage and write the following code.

One procedure will set the map component into "none" interaction. You can then capture the users actions using the onClick. The onClick event gives you all you need to pass a point back to the geomovieclip.

function setPointMode() {
my_map.interaction = "none";
my_map.onClick = function(myPointXY:Object,myMapXY:Object) {
addThatPoint(myMapXY);
}
}

function addThatPoint(myMapXY:Object) {
var m:Object = new Object();
m.point = myMapXY;
m.OBJECTID = myid.text;
myid.text = Number(myid.text) + 1;
myGeo.addPoint(m);
}

 

Here you have an example that shows you how to do this. Note the text field. Geomovieclip will use the OBJECTID as a unique identifier. In this case we expect this to be a number but it doesn't need to be. The user add points here but you could as well load this from a server and plot the points on the map.

Download the example here : addPoints.fla