<?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 Create a feature layer and add to map in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/create-a-feature-layer-and-add-to-map/m-p/17384#M360</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How to to use ActionScript codes to to create a feature layer and add to map, rather than mxml? Are there any examples? Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 09 Oct 2012 01:43:06 GMT</pubDate>
    <dc:creator>XintaoLiu</dc:creator>
    <dc:date>2012-10-09T01:43:06Z</dc:date>
    <item>
      <title>Create a feature layer and add to map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/create-a-feature-layer-and-add-to-map/m-p/17384#M360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How to to use ActionScript codes to to create a feature layer and add to map, rather than mxml? Are there any examples? Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Oct 2012 01:43:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/create-a-feature-layer-and-add-to-map/m-p/17384#M360</guid>
      <dc:creator>XintaoLiu</dc:creator>
      <dc:date>2012-10-09T01:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create a feature layer and add to map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/create-a-feature-layer-and-add-to-map/m-p/17385#M361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Similar &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://forums.arcgis.com/threads/58388-Initialize-client-side-FeatureLayer-with-FeatureCollection?p=201101#post201101" rel="nofollow" target="_blank"&gt;question&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Smthing like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;private function addFeaturelayerToMap():void { [INDENT]var featureLayer:FeatureLayer = new FeatureLayer(); featureLayer.id = "myFeatureLayer"; featureLayer.name = "My fLayer"; featureLayer.url = "http://my host/arcgis/rest/services/my folder/my service/FeatureServer/0"; featureLayer.disableClientCaching = true; featureLayer.mode = FeatureLayer.MODE_ON_DEMAND; // TODO add other needed parameters and event listeners here featureLayer.addEventListener(LayerEvent.LOAD, onFeatureLayerLoad); featureLayer.addEventListener(LayerEvent.LOAD_ERROR, onFeatureLayerLoadError);&amp;nbsp; map.addLayer(featureLayer); // add layer to map[/INDENT] }&amp;nbsp; protected function onFeatureLayerLoad(event:LayerEvent):void { [INDENT]featureLayer.removeEventListener(LayerEvent.LOAD, onFeatureLayerLoad); featureLayer.removeEventListener(LayerEvent.LOAD_ERROR, onFeatureLayerLoadError); trace("&amp;gt;&amp;gt;&amp;gt; Layer with id: '" + event.layer.id + "' loaded.");[/INDENT] }&amp;nbsp; protected function onFeatureLayerLoadError(event:LayerEvent):void { [INDENT]featureLayer.removeEventListener(LayerEvent.LOAD, onFeatureLayerLoad); featureLayer.removeEventListener(LayerEvent.LOAD_ERROR, onFeatureLayerLoadError); trace("&amp;gt;&amp;gt;&amp;gt; Layer with id: '" + event.layer.id + "' not loaded.");[/INDENT] }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;com.esri.ags.Map &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/Map.html#addLayer()" rel="nofollow" target="_blank"&gt;addLayer()&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Oct 2012 05:06:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/create-a-feature-layer-and-add-to-map/m-p/17385#M361</guid>
      <dc:creator>IvanBespalov</dc:creator>
      <dc:date>2012-10-09T05:06:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create a feature layer and add to map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/create-a-feature-layer-and-add-to-map/m-p/17386#M362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; Similar&amp;nbsp;&amp;nbsp; &lt;A href="http://forums.arcgis.com/threads/58388-Initialize-client-side-FeatureLayer-with-FeatureCollection?p=201101#post201101" rel="nofollow noopener noreferrer" target="_blank"&gt;question&lt;/A&gt;.&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;Smthing like this:&amp;nbsp; &lt;BR /&gt; &lt;PRE class="lia-code-sample line-numbers language-none"&gt;private function addFeaturelayerToMap():void
{
[INDENT]var featureLayer:FeatureLayer = new FeatureLayer();
featureLayer.id = "myFeatureLayer";
featureLayer.name = "My fLayer";
featureLayer.url = "http://my host/arcgis/rest/services/my folder/my service/FeatureServer/0";
featureLayer.disableClientCaching = true;
featureLayer.mode = FeatureLayer.MODE_ON_DEMAND;
&lt;SPAN style="color:&amp;quot;#008000&amp;quot;;"&gt;// TODO add other needed parameters and event listeners here&lt;/SPAN&gt;
featureLayer.addEventListener(LayerEvent.LOAD, onFeatureLayerLoad);
featureLayer.addEventListener(LayerEvent.LOAD_ERROR, onFeatureLayerLoadError);

map.addLayer(featureLayer); &lt;SPAN style="color:&amp;quot;#008000&amp;quot;;"&gt;// add layer to map&lt;/SPAN&gt;[/INDENT]
}

protected function onFeatureLayerLoad(event:LayerEvent):void
{
[INDENT]featureLayer.removeEventListener(LayerEvent.LOAD, onFeatureLayerLoad);
featureLayer.removeEventListener(LayerEvent.LOAD_ERROR, onFeatureLayerLoadError);
trace("&amp;gt;&amp;gt;&amp;gt; Layer with id: '" + event.layer.id + "' loaded.");[/INDENT]
}

protected function onFeatureLayerLoadError(event:LayerEvent):void
{
[INDENT]featureLayer.removeEventListener(LayerEvent.LOAD, onFeatureLayerLoad);
featureLayer.removeEventListener(LayerEvent.LOAD_ERROR, onFeatureLayerLoadError);
trace("&amp;gt;&amp;gt;&amp;gt; Layer with id: '" + event.layer.id + "' not loaded.");[/INDENT]
}&lt;/PRE&gt; &lt;BR /&gt; &lt;BR /&gt;com.esri.ags.Map&amp;nbsp;&amp;nbsp; &lt;A href="http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/Map.html#addLayer()" rel="nofollow noopener noreferrer" target="_blank"&gt;addLayer()&lt;/A&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help, it is really help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:42:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/create-a-feature-layer-and-add-to-map/m-p/17386#M362</guid>
      <dc:creator>XintaoLiu</dc:creator>
      <dc:date>2021-12-10T20:42:05Z</dc:date>
    </item>
  </channel>
</rss>

