Hi all I met an error when I try to add a Graphic to a GraphicsLayer which have already contained this Graphic.I don't remember whether is ok by using old version API. My environments are Flex sdk 4.5, ArcGIS API for Flex 2.3.1 and Windows7 X64.Thanks for your help !My code is very simple like below :private var g:Graphic=new Graphic();
private function addGraphic ():void
{
graphicsLayer.add(g);
}
And when I call this 'addGraphic ()' function twice,it would rise an error as follow:RangeError: Error #2006: The supplied index is out of bounds.
at flash.display::DisplayObjectContainer/addChildAt()
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$addChildAt()
at mx.core::UIComponent/addChildAt()
at com.esri.ags.layers::GraphicsLayer/collectionAddHandler()
at com.esri.ags.layers::GraphicsLayer/collectionChangeHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.collections::ListCollectionView/dispatchEvent()
at mx.collections::ListCollectionView/addItemsToView()
at mx.collections::ListCollectionView/listChangeHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.collections::ArrayList/internalDispatchEvent()
at mx.collections::ArrayList/addItemAt()
at mx.collections::ListCollectionView/addItemAt()
at mx.collections::ListCollectionView/addItem()
at com.esri.ags.layers::GraphicsLayer/add()
at gtest/button1_clickHandler()
at gtest/___gtest_Button1_click()