for (var i2:Number = 0; i2 < oidArray.length; i2++) { try { resultsoid = ""+oidArray[i2].ObjectID; Alert.show(resultsoid+"\n\n"+""+allGraphicMarkers.attributes, "test wth"); for each (var attributes:Object in allGraphicMarkers.attributes) { if (resultsoid == (""+allGraphicMarkers.attributes)) { //highlightedGraphicMarker.symbol = _sms_resultsBlue; Alert.show(resultsoid+"\n\n"+""+allGraphicMarkers.attributes, "did i get here2?"); break; } } } catch(errorObj:Error) { Alert.show(errorObj.toString(),"1361"); }
Solved! Go to Solution.
for (var i2:Number = 0; i2 < oidArray.length; i2++) { try { var obj:Object = allGraphicMarkers.attributes; //Assuming the ObjectID is the name of the object id field in the layer that was queried if ( obj["ObjectID"] == oidArray[i2].ObjectID) Alert.show(oidArray[i2].ObjectID.toString() + "\n\n" + obj["ObjectID"].toString(), "did i get here2?"); } catch(errorObj:Error) { Alert.show(errorObj.toString(),"1361"); } }
for (var i2:Number = 0; i2 < oidArray.length; i2++) { try { var obj:Object = allGraphicMarkers.attributes; //Assuming the ObjectID is the name of the object id field in the layer that was queried if ( obj["ObjectID"] == oidArray[i2].ObjectID) Alert.show(oidArray[i2].ObjectID.toString() + "\n\n" + obj["ObjectID"].toString(), "did i get here2?"); } catch(errorObj:Error) { Alert.show(errorObj.toString(),"1361"); } }
for (var i3:int = 0; i3 < parsedXYArrayNEW.length; i3++) { var myResult2:MapPoint = new MapPoint(Number(parsedXYArrayNEW[i3].X),Number(parsedXYArrayNEW[i3].Y),new SpatialReference(3424)); allGraphicMarkers = new Graphic(myResult2,_sms_resultsRed_AP); allGraphicMarkers.attributes = parsedXYArrayNEW[i3].ObjectID;//if I didn't add this, I wouldn't get any attributes in my graphics. Alert.show(""+allGraphicMarkers.attributes,"1263");//yes, this returns a distinct ObjectID value (the only thing populated in the alert box //is a numeric value like 111111 or 111112) //for each graphic, but is it really "ObjectID"? this._gl_resultsMarkersAll.add(allGraphicMarkers); } }
var obj:Object = allGraphicMarkers.attributes; for (var i2:Number = 0; i2 < oidArray.length; i2++) { //your suggested code which makes total sense if ( obj["ObjectID"] == oidArray[i2].ObjectID) { Alert.show(oidArray[i2].ObjectID.toString() + "\n\n" + obj["ObjectID"].toString(), "did i get here2?"); //allGraphicsMarkers.symbol = _sms_resultsBlue; } }
for (var i3:int = 0; i3 < parsedXYArrayNEW.length; i3++) { var myResult2:MapPoint = new MapPoint(Number(parsedXYArrayNEW[i3].X),Number(parsedXYArrayNEW[i3].Y),new SpatialReference(3424)); allGraphicMarkers = new Graphic(myResult2,_sms_resultsRed_AP); var atts:Object = new Object(); atts.ObjectID = Number(parsedXYArrayNEW[i3].ObjectID); atts.xCoord = Number(parsedXYArrayNEW[i3].X); atts.yCoord = Number(parsedXYArrayNEW[i3].Y); allGraphicMarkers.attributes = atts; Alert.show(allGraphicMarkers.attributes.ObjectID.toString(),"1263"); _gl_resultsMarkersAll.add(allGraphicMarkers); }