I simply extend Symbol and get a reference to the ClusterGraphic by overriding the draw method. Something like this...then use the symbol as the symbol for the graphicslayer's clusterer...this is
import com.esri.ags.Map;
import com.esri.ags.clusterers.supportClasses.ClusterGraphic;
import com.esri.ags.geometry.Geometry;
import com.esri.ags.symbols.Symbol;
import flash.display.Sprite;
import flash.events.MouseEvent;
public class MouseEventsClusterSymbol extends Symbol
{
public function MouseEventsClusterSymbol()
{
super();
}
override public function draw(sprite:Sprite, geometry:Geometry, attributes:Object, map:Map):void
{
super.draw(sprite, geometry, attributes, map);
const clusterGraphic:ClusterGraphic = sprite as ClusterGraphic;
if(clusterGraphic)
{
clusterGraphic.addEventListener(MouseEvent.ROLL_OVER, graphicRollOverHandler);
clusterGraphic.addEventListener(MouseEvent.ROLL_OUT, graphicRollOutHandler);
clusterGraphic.addEventListener(MouseEvent.CLICK, graphicClickHandler);
}
}
override public function clear(sprite:Sprite):void
{
super.clear(sprite);
const clusterGraphic:ClusterGraphic = sprite as ClusterGraphic;
if(clusterGraphic)
{
clusterGraphic.removeEventListener(MouseEvent.ROLL_OVER, graphicRollOverHandler);
clusterGraphic.removeEventListener(MouseEvent.ROLL_OUT, graphicRollOutHandler);
clusterGraphic.removeEventListener(MouseEvent.ROLL_OUT, graphicClickHandler);
}
}
}
Then use it in the GraphicsLayer's clusterer:
<esri:GraphicsLayer>
<esri:clusterer>
<esri:WeightedClusterer>
<esri:symbol>
<collections:MouseEventsClusterSymbol />
</esri:symbol>
</esri:WeightedClusterer>
</esri:clusterer>
</esri:GraphicsLayer>
-------
I've been really digging AS3 Signals, so in my handlers, I send out a signal with a reference to the cluster graphic and handle the logic outside of the symbol itself...Hope this helps the cause.
Brendan