<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to handle layer loading error when target server is down? in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-handle-layer-loading-error-when-target/m-p/325594#M7771</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You could try and wrap your request in a try ... catch block to catch the Security exception, or you could attempt to download the policy file to see if it exists before you load the layer using URLLoader and using its events for example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html?filter_flex=4.1&amp;amp;filter_flashplayer=10.1&amp;amp;filter_air=2"&gt;http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html?filter_flex=4.1&amp;amp;filter_flashplayer=10.1&amp;amp;filter_air=2&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Dec 2010 21:29:26 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2010-12-28T21:29:26Z</dc:date>
    <item>
      <title>How to handle layer loading error when target server is down?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-handle-layer-loading-error-when-target/m-p/325593#M7770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've got a reference to a map service that is hosted by an external agency and today their server was down.&amp;nbsp; LayerEvent.LOAD_ERROR fires but too late... after the crossdomain.xml security exception is thrown (because it can't be loaded if no server is present).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not quite sure the best way to handle this and hoping someone has dealt with this and can offer some suggestions. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Royce&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Dec 2010 20:47:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-handle-layer-loading-error-when-target/m-p/325593#M7770</guid>
      <dc:creator>RoyceSimpson</dc:creator>
      <dc:date>2010-12-28T20:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle layer loading error when target server is down?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-handle-layer-loading-error-when-target/m-p/325594#M7771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You could try and wrap your request in a try ... catch block to catch the Security exception, or you could attempt to download the policy file to see if it exists before you load the layer using URLLoader and using its events for example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html?filter_flex=4.1&amp;amp;filter_flashplayer=10.1&amp;amp;filter_air=2"&gt;http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html?filter_flex=4.1&amp;amp;filter_flashplayer=10.1&amp;amp;filter_air=2&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Dec 2010 21:29:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-handle-layer-loading-error-when-target/m-p/325594#M7771</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2010-12-28T21:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle layer loading error when target server is down?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-handle-layer-loading-error-when-target/m-p/325595#M7772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You could try and wrap your request in a try ... catch block to catch the Security exception, or you could attempt to download the policy file to see if it exists before you load the layer using URLLoader and using its events for example:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html?filter_flex=4.1&amp;amp;filter_flashplayer=10.1&amp;amp;filter_air=2"&gt;http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html?filter_flex=4.1&amp;amp;filter_flashplayer=10.1&amp;amp;filter_air=2&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks Michael,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've actually tried both your suggestions and got stumped on both accounts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;With the try/catch block... I put "map.addLayer(layer)" in the try section and the catch never got triggered, even though I still got the crossdomain.xml exception at runtime.&amp;nbsp; So I'm not to sure which code should be going in there.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In terms of the URLLoader example,&amp;nbsp; I tried a solution based on that exact example and was having an issue with the load taking so long... The error event would eventually fire but only after a lengthy URL load timeout window... by that time, the app is up and the user is interacting, which would lead to a mess of code changes to enable and disable various controls that are linked to that map service.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In other words, if you have to wait the 30+/- seconds for the request to timeout (looking for the non existent server) all kinds of goofiness ensues because the user is already into the app and interacting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Royce&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Dec 2010 22:17:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-handle-layer-loading-error-when-target/m-p/325595#M7772</guid>
      <dc:creator>RoyceSimpson</dc:creator>
      <dc:date>2010-12-28T22:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle layer loading error when target server is down?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-handle-layer-loading-error-when-target/m-p/325596#M7773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok, so I got this working but not all that happy with the solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I setup an initial URLStream of the map service in question with a Complete event to fire when the data has been full retrieved.&amp;nbsp; If the target server is down, that won't happen for about 30 seconds.&amp;nbsp; If the target server is up, the event will fire very quickly (under a second).&amp;nbsp; Either way, I have a module level boolean flag that gets set to true when that event fires.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the meantime, I also set a Timer to fire a tick event after 2 seconds.&amp;nbsp; When the event is triggered, it checks the stream flag.&amp;nbsp; If true, then I go ahead and create the map layer and load it into the map.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the timer completes at the end of the two seconds and the flag is still false, the stream is closed, set to null and I don't load the map service.&amp;nbsp; I then notify the end user that the service not available.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Seems like there should be a MUCH easier way to do this.&amp;nbsp; Hopefully I've missed something elementary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have a great New Year's all.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-r&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Dec 2010 22:07:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-handle-layer-loading-error-when-target/m-p/325596#M7773</guid>
      <dc:creator>RoyceSimpson</dc:creator>
      <dc:date>2010-12-29T22:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle layer loading error when target server is down?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-handle-layer-loading-error-when-target/m-p/325597#M7774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Related discussion:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/15721-checking-if-a-service-is-availible"&gt;http://forums.arcgis.com/threads/15721-checking-if-a-service-is-availible&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The same issue exists in all the RESTful clients.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Dec 2010 10:31:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/how-to-handle-layer-loading-error-when-target/m-p/325597#M7774</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2010-12-30T10:31:01Z</dc:date>
    </item>
  </channel>
</rss>

