Get your own customer support community
 

Creation policy

I am struggling to use com.modestmaps.flex.Map in my code because of the current creation policy with respect to its map property. The com.modestmaps.Map object isn't created until drawing (in updateDisplayList()), which means I can't do this code:

var flexMap:Map = new Map(); // com.modestmaps.flex.Map
// configure map here...
addChild(flexMap);
flexMap.map.putMarker(...); // ERROR: flexMap.map is null

Instead I have to wait to add the markers until flexMap's creation complete event, which can be inconvient.

Similary I can't do:
var flexMap:Map = new Map();
// configure map here...
addChild(flexMap);
flexMap.map.addEventListener(MapEvent.PANNED, ...);
for the same reason. And com.modestmaps.flex.Map has no similar event.

It seems the code has changed from creating the map object in the createChildren() override. Is there a workaround to this? What's the reason for the delaying creating the map until drawing?

Follow this discussion to get notifications on your dashboard.


User_default_medium