Select to view content in your preferred language

z-Index

799
1
01-30-2012 06:00 AM
StevenColeman-Williams
Emerging Contributor
Hi I have a graphics layer which i have no control over the order (ie in what order i receive them from a async call

i need to move a particular graphic right to the very back

it is the only polygon in the graphic set (garunteed) how can i Do this?
Tags (2)
0 Kudos
1 Reply
DasaPaddock
Esri Regular Contributor
The GraphicsLayer watches for changes to its graphicsProvider.

See:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/layers/GraphicsLayer.html#graphicProvider

Try:

public function moveGraphicToBack(graphic:Graphic):void
{
    var graphicsProvider:ArrayCollection = graphicsLayer.graphicProvider as ArrayCollection;
    
    var index:int = graphicsProvider.getItemIndex(graphic);
    if (index > -1)
    {
        graphicsProvider.removeItemAt(index);
    }
    
    graphicsProvider.addItemAt(graphic, 0);
}
0 Kudos