[RPC Fault faultString="HTTP request error" faultCode="Server.Error.Request" faultDetail="Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://www.arcgis.com/sharing/content/items/78e9ed6c172a43719e2114cfb7f6d306?f=json"]. URL: http://www.arcgis.com/sharing/content/items/78e9ed6c172a43719e2114cfb7f6d306?f=json"] at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler() at mx.rpc::Responder/fault() at mx.rpc::AsyncRequest/fault() at DirectHTTPMessageResponder/errorHandler() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete()
cannot convert mx.rpc.events::FaultEvent@13a5a301 to com.esri.ags.events.LayerEvent
var wmUtil:WebMapUtil = new WebMapUtil(); wmUtil.addEventListener(FaultEvent.FAULT, onWebMapUtilFault, false, 0, true); protected function onWebMapUtilFault(event:LayerEvent):void // wrong event type { // } /* TypeError: Error #1034: Type Coercion failed: cannot convert mx.rpc.events::FaultEvent@ad35f81 to com.esri.ags.events.LayerEvent. ... ... */
var wmUtil:WebMapUtil = new WebMapUtil(); wmUtil.addEventListener(FaultEvent.FAULT, onWebMapUtilFault, false, 0, true); protected function onWebMapUtilFault(event:FaultEvent):void { trace(event.fault.getStackTrace()); }
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:ags="http://www.esri.com/2008/ags"> <!-- Adobe Flex SDK 4.5.1 --> <!-- ArcGIS API for Flex 2.5 --> <!-- http://web.zone.ee/bespiva/webmaputil/ --> <s:layout> <s:HorizontalLayout gap="5" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10" /> </s:layout> <fx:Script> <![CDATA[ import com.esri.ags.Map; import com.esri.ags.events.WebMapEvent; import com.esri.ags.webmap.WebMapUtil; import mx.controls.Alert; import mx.events.FlexEvent; import mx.rpc.AsyncResponder; import mx.rpc.Fault; protected function onPanelCreationComplete(event:FlexEvent):void { var targetPanel:Panel = event.target as Panel; var wmUtil:WebMapUtil = new WebMapUtil(); switch (targetPanel.id) { case (panel1.id): { wmUtil.createMapById("69f7b98f49db4becb44ac2de3aa37dd9", new AsyncResponder(onCreateMapByIdComplete, onFault, targetPanel.id)); break; } case (panel2.id): { wmUtil.createMapById("f3b0db715d9148f7a4d3b4f8159b90b5", new AsyncResponder(onCreateMapByIdComplete, onFault, targetPanel.id)); break; } case (panel3.id): { wmUtil.createMapById("b3b981c496d443749fdc8661f9e38e65", new AsyncResponder(onCreateMapByIdComplete, onFault, targetPanel.id)); break; } case (panel4.id): { wmUtil.createMapById("78e9ed6c172a43719e2114cfb7f6d306", new AsyncResponder(onCreateMapByIdComplete, onFault, targetPanel.id)); break; } } } protected function onCreateMapByIdComplete(event:WebMapEvent, token:Object = null):void { if (event.errors.length > 0) { for (var i:int; i < event.errors.length; i++) { trace(event.errors); } return; } var map:Map = event.map as Map; if (map != null) { switch (token.toString()) { case panel1.id: { panel1.removeAllElements(); panel1.addElement(map); break; } case panel2.id: { panel2.removeAllElements(); panel2.addElement(map); break; } case panel3.id: { panel3.removeAllElements(); panel3.addElement(map); break; } case panel4.id: { panel4.removeAllElements(); panel4.addElement(map); break; } } } } protected function onFault(fault:Fault, token:Object = null):void { trace(fault.getStackTrace()); Alert.show(fault.message.toString(), "Fault"); } ]]> </fx:Script> <s:VGroup gap="5" width="100%" height="100%"> <s:Panel id="panel1" title="Top-Left panel" width="100%" height="100%" creationComplete="onPanelCreationComplete(event)"> </s:Panel> <s:Panel id="panel2" title="Bottom-Left panel" width="100%" height="100%" creationComplete="onPanelCreationComplete(event)"> </s:Panel> </s:VGroup> <s:VGroup gap="5" width="100%" height="100%"> <s:Panel id="panel3" title="Top-Right panel" width="100%" height="100%" creationComplete="onPanelCreationComplete(event)"> </s:Panel> <s:Panel id="panel4" title="Bottom-Right panel" width="100%" height="100%" creationComplete="onPanelCreationComplete(event)"> </s:Panel> </s:VGroup> </s:Application>
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.