<?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 Aggregating layers in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/aggregating-layers/m-p/423262#M9907</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my application I need to wrap all layers before adding them to the map. For this purpose I implemented proxy class: MyLayer which has similar structure:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;class MyLayer extends Layer implement MyInterface
{
public function MyLayer(originalLayer:Layer)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; this.originalLayer = originalLayer;
}
///
///overriden methods from Layer.
///

override public function createChildren():void
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; addChild(originalLayer);
}

override public function get loaded():Boolean
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; return originalLayer.loaded;
}

/// and others
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After I started testing my solution I found that for instance TiledLayer does not work because it expects the parent property to be LayerContainer (otherwise scrcollRect is null and loadTiles() throws runtime error). So I overrode scrollRect property:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
override public function get scrollRect():Rectangle
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; return parent.scrollRect;
}
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now everything works well but anyway I am not sure that in future I will not get any problems.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The reason I did this is that I need all layers added to the map implement some interface (MyInterface) that is why I decided to wrap them into my own layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you recommend something for this case or just tell what other properties (like 'scrollRect') I am required to override.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Nov 2012 19:35:32 GMT</pubDate>
    <dc:creator>DmitriyKukharev</dc:creator>
    <dc:date>2012-11-30T19:35:32Z</dc:date>
    <item>
      <title>Aggregating layers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/aggregating-layers/m-p/423262#M9907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my application I need to wrap all layers before adding them to the map. For this purpose I implemented proxy class: MyLayer which has similar structure:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;class MyLayer extends Layer implement MyInterface
{
public function MyLayer(originalLayer:Layer)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; this.originalLayer = originalLayer;
}
///
///overriden methods from Layer.
///

override public function createChildren():void
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; addChild(originalLayer);
}

override public function get loaded():Boolean
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; return originalLayer.loaded;
}

/// and others
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After I started testing my solution I found that for instance TiledLayer does not work because it expects the parent property to be LayerContainer (otherwise scrcollRect is null and loadTiles() throws runtime error). So I overrode scrollRect property:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
override public function get scrollRect():Rectangle
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; return parent.scrollRect;
}
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now everything works well but anyway I am not sure that in future I will not get any problems.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The reason I did this is that I need all layers added to the map implement some interface (MyInterface) that is why I decided to wrap them into my own layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you recommend something for this case or just tell what other properties (like 'scrollRect') I am required to override.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Nov 2012 19:35:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/aggregating-layers/m-p/423262#M9907</guid>
      <dc:creator>DmitriyKukharev</dc:creator>
      <dc:date>2012-11-30T19:35:32Z</dc:date>
    </item>
  </channel>
</rss>

