Error in Identify tool in a sample code

469
5
11-02-2010 09:26 AM
GISTeam
New Contributor
Hi to all,

I found this example --> http://resources.esri.com/arcgisserver/apis/flex/index.cfm?fa=codeGalleryDetails&scriptID=15824   and it contains a lot of useful features. The one that we are most interested at is the ID Features tool that identifies all layers. The problem is that, when debugged the application gives out this 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.DragPanel::IDResults/identifyCompleteHandler()
at com.DragPanel::IDResults/__identifyTask_identifyComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.esri.ags.tasks::IdentifyTask/handleDecodedObject()
at Function/http://adobe.com/AS3/2006/builtin::call()
at com.esri.ags.tasks::BaseTask/handleResult()
at Function/<anonymous>()
at mx.rpc::Responder/result()
at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()
at mx.rpc.events::ResultEvent/http://www.adobe.com/2006/flex/mx/internal::callTokenResponders()
at mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
at mx.rpc::Responder/result()
at mx.rpc::AsyncRequest/acknowledge()
at DirectHTTPMessageResponder/completeHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()

and after that another one:

ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::$removeChild()
at mx.core::UIComponent/removeChild()
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.DragPanel::IDResults/identifyCompleteHandler()
at com.DragPanel::IDResults/__identifyTask_identifyComplete()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.esri.ags.tasks::IdentifyTask/handleDecodedObject()
at Function/http://adobe.com/AS3/2006/builtin::call()
at com.esri.ags.tasks::BaseTask/handleResult()
at Function/<anonymous>()
at mx.rpc::Responder/result()
at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()
at mx.rpc.events::ResultEvent/http://www.adobe.com/2006/flex/mx/internal::callTokenResponders()
at mx.rpc.http.mxml::HTTPService/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
at mx.rpc::Responder/result()
at mx.rpc::AsyncRequest/acknowledge()
at DirectHTTPMessageResponder/completeHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()


Has anyone used this code and found a solution or knows a way to work around it?

Thank you!
Tags (2)
0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus
gis-varna,

   That code is over 2 years old... Are you sure you want to use it as a source for current development?
0 Kudos
GISTeam
New Contributor
gis-varna,

   That code is over 2 years old... Are you sure you want to use it as a source for current development?


That is a good point. I guess I'll have to use "Identify Parameters" example.

Is there a way for this "Identify Parameters" example to be changed to get info directly from the Dynamic map, because I want it to see the changes when somebody turns off a layer from the TOC?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
gis-varna,

   You are going to have to check the visibleLayers property of each map service that is in the map, and use those results to set the identify parameters layerIds property. There are lots of different version of identify widgets out there in the forums and code gallery many by me and some by others that you can look at for code examples.
0 Kudos
GISTeam
New Contributor
gis-varna,

   You are going to have to check the visibleLayers property of each map service that is in the map, and use those results to set the identify parameters layerIds property. There are lots of different version of identify widgets out there in the forums and code gallery many by me and some by others that you can look at for code examples.


Thank you very much Robert for all your help!

I found this thread --> http://forums.esri.com/Thread.asp?c=158&f=2421&t=297427#945543 and they talk about a similar thing, but they mention an example you wrote and I sttruggle to find it.

Can you please provide me with a link to the mentioned example?

Best Regards
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
gis-varna,

   Try this one http://forums.esri.com/Attachments/38381.zip
and here is the thread that the link comes from http://forums.esri.com/Thread.asp?c=158&f=2421&t=291265&mc=35#msgid920482
0 Kudos