Navigate to a different Location using FlyTo()

Apr 6, 2010 at 4:35 PM
Edited Apr 6, 2010 at 4:36 PM

I have a Lot of pushpins in myMap! I want to navigate to a different coordinate using Map.FlyTo( newLatLong, -90, 0, 4902.49164766259, null); Without using  a pin_click event. I have a random method with the list of my pins location, where I want to call this Map.FlyTo( newLatLong, -90, 0, 4902.49164766259, null);  And I get the following exception:

Object is not ready for use.  If starting up, please use Host.RenderEngine.Initialized.  Alternatively, it may be already torn down or disposed.

in VEMap.cs

The block of code that gives this exception is:

this.globeControl.Host.CommunicationManager.AttachToEvent(EngineEvents.Group,EngineEvents.OnFlyToEnd,"OnFlyToEnd",OnFlyToEnd);

 

Any suggestions?

 

  

Coordinator
Apr 6, 2010 at 6:49 PM

You can't call FlyTo or any other map things until it has finished setting itself up. There are some asynchronous processes going on, then when it is ready it called the MapLoaded event.

Try not calling FlyTo until MapLoaded is called.