Select to view content in your preferred language

Multiple Polygons on a Graphics Layer

446
1
02-08-2012 03:42 AM
StevenColeman-Williams
Emerging Contributor
So i have a graphics layer (gLayer)

when i draw a polygon onto graphics layer, it works ok
when i then select to draw a second, the first point i draw i get the following error

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 com.esri.ags.tools::DrawTool/addGraphic()
 at com.esri.ags.tools::DrawTool/map_clickFirstHandler()
 at flash.events::EventDispatcher/dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at mx.core::UIComponent/dispatchEvent()
 at com.esri.ags::Map/dispatchMapMouseEvent()
 at com.esri.ags::Map/mouseUpHandler()


BUT, if i do
gLayer.clear()
before hand it works ok

any ideas?
Tags (2)
0 Kudos
1 Reply
IvanBespalov
Frequent Contributor
Steven,

this sample code works perfectly.

Can you show your code?
What version of ArcGIS API for Flex is used?
0 Kudos