How do you get the clusters from a clusterer....to determine if certain graphics are within a cluster or not? GraphicsLayer and Clusterer do not have a property or method to get the clusters currently drawn.
The graphicProvider is unaffected by the clustering.
Try this:
for (var i:int = 0, n:int = myGraphicsLayer.numChildren; i < n; i++)
{
var graphic:Graphic = myGraphicsLayer.getChildAt(i) as Graphic;
if (graphic is ClusterGraphic)
{
trace(graphic);
}
}
One thing you can do is to subclass Symbol and add additional listeners in the draw method (but make sure you also remove them in the clear method). I started with Mansour's attribute clusterer found here. In the AttrClusterSymbol.as draw method, you can add:
override public function draw(sprite:Sprite, geometry:Geometry, attributes:Object, map:Map):void { const clusterGraphic:ClusterGraphic = sprite as ClusterGraphic; clusterGraphic.addEventListener(MouseEvent.ROLL_OVER, graphicRollOverHandler); clusterGraphic.addEventListener(MouseEvent.ROLL_OUT, graphicRollOutHandler); clusterGraphic.addEventListener(MouseEvent.CLICK, graphicClickHandler);
........ }
you can then get the cluster.graphics off of the clusterGraphic when the user interacts with it.
Not sure if this will solve your problem, but it work well for me.
Again, just remember to remove these listeners in the clear method so don't you have crazy leaks.