Highlight symbols of different colors

2046
0
06-03-2011 08:13 AM
StuartLorentz
New Contributor
I'm trying to highlight the selected symbol by setting transparency to 0 (default symbol is set to 60%). I know how to do this if all the symbols are the same color, but how can it be accomplished if the symbols are four different colors? 

function that load the symbols to the layer
function loadToPoints(numLat, numLon, strBox, strText, idColor)
{
//initialize symbology

var lat = numLat;
var lng = numLon;
if (idColor=='red') {
var symbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([255,0,0,.6]));
}
if (idColor=='orange') {
var symbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([255,124,0,.6]));
}
if (idColor=='yellow') {
var symbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([255,255,0,.6]));
}
if (idColor=='green') {
var symbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([0,255,0,.6]));
}
var pt = new esri.geometry.Point(lng,lat,new esri.SpatialReference({'wkid':4326}));
var xyPt = new esri.geometry.geographicToWebMercator(pt);
var graphic = new esri.Graphic(xyPt, symbol);
var infoTemplate = new esri.InfoTemplate();
var strTitle = "Event: " + strText;
infoTemplate.setTitle(strTitle);
infoTemplate.setContent(strBox);
map.infoWindow.resize(300,225);
graphic.setInfoTemplate(infoTemplate);
outagesLayer.add(graphic);
}

i figure i need to define the highlightSymbol in this function, but how do i use it when a mouse event occurs.
0 Kudos
0 Replies