Virtual land adds pushpins to address - events that fail

I was working on a mapping project to display service orders for a utility company, but I have some issues with the numbering on my contacts and info fields. Below is a small segment of the page Im working to demonstrate the problem.
http://www.evocommand.com/junk_delete_me/virtual_earth_testing/VirtualEarthTest.html

Once you open it, there will be a link at the top for "Test Pins" which will display 5 buttons on the screen.

I believe the problem lies in the order of events. The pins are generated by looking up addresses using map.Find () inside the AddPushpinByAddress () function. The problem is that all 5 AddPushpinByAddress () calls are fired before the callback functions from the final Map.Find () parameter are triggered - this is where the contacts are actually created. The end result is that all 5 pins in the example are rendered with pin number, title, and description of the last pin to be drawn. Any suggestions?

+2


a source to share


2 answers


using local or global "var" or multiple instances failed.



In the end I gave up and used "setTimeout ()" in javascript to delay the delay and allow the virtual land to find the location before it arrived at the next button. I am sure there are better methods, but practicality in the name of progress has not reached perfection / accuracy.

0


a source


You are definitely right. Since you are using a global object to store the id (and all other values) of the pin, when it goes to write it, you only get the last value.



I would create a new pushpin instance in your AddPushpinByAddress function and pass this button for a callback to set properties. I have some similar code if you really need to, but moving these out of the globals and using a pushpin object (or creating your own object) that you can pass will take care of this problem.

0


a source







All Articles