Hello,
I have a problem when I try execute the method getShape().moveToFront() (or getShape().moveToBack()) JUST on polygons (other geometries work) by API. For example, I did a test in the Sandbox (ArcGIS API for JavaScript Sandbox) where I update a part of the code just to replic the problem (code below). I added a polygon, after that I drew a polyline (on the polygon), so I click in "arrow" to call the function test(), and nothing happened, but when I click in "line" to call "teste2()", it work. Could Somebody help me?
thank you.
function activateTool() {
var tool = this.label.toUpperCase().replace(/ /g, "_");
if(tool==="ARROW"){
test();
return;
}
if(tool==="LINE"){
test2();
return;
}
toolbar.activate(Draw[tool]);
map.hideZoomSlider();
}
function test(){
map.graphics.graphics[1].getShape().moveToFront();
}
function test2(){
map.graphics.graphics[2].getShape().moveToBack();
}
function createToolbar(themap) {
toolbar = new Draw(map);
toolbar.on("draw-end", addToMap);
}
function addToMap(evt) {
var symbol;
toolbar.deactivate();
map.showZoomSlider();
switch (evt.geometry.type) {
case "point":
case "multipoint":
symbol = new SimpleMarkerSymbol();
break;
case "polyline":
symbol = new SimpleLineSymbol();
break;
default:
symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new esri.Color([223,223,223,1]), 6), new esri.Color([223,223,223,1]));
break;
}