jamboharris

Map Initialization Lifecycle

Discussion created by jamboharris on Jun 23, 2011
Latest reply on Jun 27, 2011 by jamboharris
Hi all,

As my map loads, I run through some initialization; applying the correct extent to the map and putting some data into a GraphicLayer.

Is there a standard way to check/listen for initialization? 

I've been using the

Map.Initialized


event but, for example, the Map.SpatialReference (which I need to know to calculate the extent) and the Map.Layers aren't ready at this point.  I've also tried the

Map.Layers.LayersInitialized


event, which correctly lets me know when the Graphics layer is ready for data, but there is no Map.Layers.IsInitialized property for me to check.  (I'm building Behaviors so I don't necessarily know if I've been attached at init or at a later stage.)  It also seems a bit weird to check this when waiting for the Map.SpatialReference to be ready, but I guess that perhaps this value comes from the Layers?

Just wondered if there was a resource describing this lifecycle or any recommendations on how to deal with it?  Any thoughts or suggestions gratefully received!!

Thanks,
James

Outcomes