I have a problem using the markers.
When I put multiple markers on the map, and subsequently zoom in, only the last marker is successfully repositioned. The rest doesn't seem to position themselves in the right location. Any help on this would be great.
1
person has this problem
I have this problem, too!
Tell me when someone solves it.
The more people who report this problem, the more it gets noticed.
The more people who report this problem, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?create a container with just points and try implementing the following as an eventobserver function that load once panning or zooming is finished...
so when the data comes in...load them into an array
==================
for (var r in res) {
var lat:Number = res[r].Latitude[0];
var lon:Number = res[r].Longitude[0];
var loc = new Location( lat, lon );
var tit:String = res[r].Title ? ' ' + res[r].Title[0] + '
': _mapPointHeader ? _mapPointHeader : '';
var desc:String = res[r].Description ? ' ' + res[r].Description[0] + '
': _mapPointBody ? _mapPointBody : '';
_mapPoints.push({id:points, tit:tit, desc:desc, loc:loc});
_extent.push(loc);
//_map.putMarker(points, loc);
points++;
}
these are the observers that fire ( check out casa )
_map.addEventObserver(this, Map.EVENT_START_PANNING, 'removePoints');
_map.addEventObserver(this, Map.EVENT_STOP_PANNING, 'adjustPoints');
_map.addEventObserver(this, Map.EVENT_START_ZOOMING, 'removePoints');
_map.addEventObserver(this, Map.EVENT_STOP_ZOOMING, 'adjustPoints');
and then have this function fire after every event to the map ( panning zooming ) is finished...
===================
private function adjustPoints() {
for ( var p in _mapPoints ) {
// var pnt = _map.mapPointToPoint( _mapPoints[p].id, _pointsContainer );
// trace('pnt: ' + pnt);
var pointXY:Object = _map.locationPoint( _mapPoints[p].loc, _pointsContainer );
// make sure it's in the bounds of the points container
if (pointXY.x > 0 && pointXY.x <= (_pointsBoundsW - 20) && pointXY.y > 20 && pointXY.y <= _pointsBoundsH) {
var point = _pointsContainer.attachMovie('map_point', 'map_point' + _pointsContainer.getNextHighestDepth(), _pointsContainer.getNextHighestDepth(), {_x:pointXY.x, _y:pointXY.y, id:p});
if (_mapPoints[p].tit.length > 0) {
point.addEventObserver(this, EventMovieClip.EVENT_ROLL_OVER, 'popUpOn');
point.addEventObserver(this, EventMovieClip.EVENT_ROLL_OUT, 'popUpOff');
point.addEventObserver(this, EventMovieClip.EVENT_RELEASE_OUTSIDE, 'popUpOff');
}
}
}
}
removing the points
=========================
private function removePoints() {
for ( var p in _pointsContainer ) {
_pointsContainer[p].removeEventObserversForScope(this);
removeMovieClip(_pointsContainer[p]);
}
}
I’m happy
-
Inappropriate?If you create multiple markers with the same ID only the last one will properly managed. Be sure all makers have unique IDs.
-
Inappropriate?is the _pointsContainer some type of casa framework variable? where can i find some more examples about markers?
Loading Profile...




