I have the following basic loop shown below, which loops thru the featureSet adding the graphic and tooltip. I currently use the same loop in other areas of my application with no problems. This loop correctly adds my graphic to the graphic layer, but will only add the last tooltip variable in the loop as a tooltip to all the graphics in the loop.
AQ.where = SrchString; Sub_QueryTask.execute(AQ, new AsyncResponder(subResult, subFault)); function subResult(featureSet:FeatureSet, token:Object = null ):void{ if (featureSet.features.length > 0){ for each (var myGraphic:Graphic in featureSet.features){ //myGraphic.autoMoveToTop=true; var RandomColor:uint = 0xffffff * Math.random(); var RandomFill:SimpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, RandomColor, 0.5); myGraphic.symbol = RandomFill; Sub_Gra_Layer.toolTip = myGraphic.attributes.PATSUB_SUB_KEY; Sub_Gra_Layer.add(myGraphic); trace(Sub_Gra_Layer.toolTip.toString()); }
While debugging, I can see the correct tooltip values being looped thru but only the last one gets displayed on the map. The only difference from this loop vs others in my app, is that I'm binding the Sub_Gra_Layer to a graphics layer in the parent app. It doesn't appear to be a problem, because the graphics are being added correctly and one tooltip is being added; Therefore, I'm assumning the binding is ok. I've also replaced the Sub_Gra_Layer variable with the main app graphic layer......