Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

VEShape.GetZIndex Method

You are not viewing the latest version of the AJAX control. Bing Maps AJAX V7 is the recommended JavaScript control for Bing Maps. If you need this documentation, it is available in as a CHM or PDF download.

Gets the z-index of a pushpin shape or pushpin attached to a polyline or polygon.


An integer containing the z-index of the pushpin shape or pushpin attached to a polyline or polygon. Use the VEShape.GetZIndexPolyShape Method to get the z-indices for a polyline or polygon.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>

      <script type="text/javascript">
         var map = null;
         var myShape = null;  // For polygon
         var myPin   = null;  // For pushpin

         var Red   = new VEColor(255,   0,   0, 1.0);

         var topLeft  = new VELatLong(45.5, -116.5);
         var topRight = new VELatLong(45.5, -106.5);
         var botRight = new VELatLong(35.5, -106.5);
         var botLeft  = new VELatLong(35.5, -116.5);

         function GetMap()
            map = new VEMap('myMap');

            // Add red polygon
            myShape = new VEShape(VEShapeType.Polygon, new Array(topLeft, topRight, botRight, botLeft));


            // Pushpin starts on top as its default zindex is 1000 while polygon is 50
            myPin = new VEShape(VEShapeType.Pushpin, new VELatLong(40.5, -111.5));


         function Switch()
            // Move the polygon in front
            myShape.SetZIndex(null, myPin.GetZIndex() + 1);

            btnswitch.disabled = "disabled";
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:600px; height:400px;"></div>
      <input id="btnswitch" type="button" value="Move Polygon to Front" name="switch" onclick="Switch();">

© 2015 Microsoft