4 Replies Latest reply on May 16, 2009 4:32 PM by mikeyjray

    Bringing Yahoo! map markers to the front

    mikeyjray Level 1

      I have a yahoo map that is loading multiple instances of "marker2.swf" onto a map, based upon their addresses.  Each marker, when rolled over, pops up a window displaying information about the location.

       

      The problem I have is that the markers get placed in order from the array in which they are taken, and are located at that depth, so that when a marker at a lower depth is rolled over, other markers will stay infront of the pop-up window, making it hard to read.

       

      There was a very similar post to this 2 years ago, but there was no resolution (not to mention my markers are different, as is their coding): http://forums.adobe.com/message/116949#116949

       

      ---

       

      Here is the section of my code that places the markers on the map:

       

      function addMarkers(xml:XML):Void {

           for (i=0; i<addressA.length; i++) {

                myMap.addMarkerByAddress(CustomSWFMarker, postalA[i],{url:"marker2.swf", ref:i, useClip:false});

           }

      }

       

      ----

      Here is the code within my marker2.swf

       

      home.onRollOver = function(){

           if(_root.enabledvar == 0){

                this.gotoAndPlay(2)

           }

      }

       

      ---

       

      I believe I would need to setup some form of swapDepths or getNextHighestDepth, which I have tried doing, but I have not been able to get it to work (and yes, the marker is a movie clip and not a button).

       

      I should also mention that there are over 375 markers placed, so whatever method is used, it would need to ensure that the marker moves beyond that number.

       

      Any help would be great!  I am lost right now!

        • 1. Re: Bringing Yahoo! map markers to the front
          kglad Adobe Community Professional & MVP

          you could hide the nearby markers or remove and add the rolled-over marker.

          • 2. Re: Bringing Yahoo! map markers to the front
            kglad Adobe Community Professional & MVP

            and i saw a similar issue using google maps.  someone suggested using a "dummy" marker (that's added last so it's above all others).  when you have a rollover set the dummy marker that rolled-over's lat/long.

            • 3. Re: Bringing Yahoo! map markers to the front
              mikeyjray Level 1

              Regarding your first suggestion, I like this idea of hiding nearby markers as I think it would be easier than removing and re-adding the marker (I cannot even think of how to do it).

               

              To make this work, would I create a listener within the marker to see if it is touching other markers, the have the listener change the _visible property?

               

              In regards to the idea of the dummy marker, what would be the best way to parse the information from the unique marker INTO this marker?  The function I'm using for the map parses the information for each location one at a time, so I don't know how I would make it "jump" from the unique marker into the dummy.

               

              Any ideas?  Thanks!

              • 4. Re: Bringing Yahoo! map markers to the front
                kglad Adobe Community Professional & MVP

                for the hide/show marker idea, you would create an array of the markers (in your addMarker function).  whenever a marker is rolled-over, you would loop through this array looking for markers that are within some distance of the rolled-over marker and hide those.

                 

                for the dummy marker idea, you would have each marker store its lat/long data (again in your addMarker function).  on rollover you would use the rolled-over marker's data for the dummy marker.