<?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: Create and clone WebStyleSymbol --&amp;gt; Not a function in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-and-clone-webstylesymbol-gt-not-a-function/m-p/1149613#M76547</link>
    <description>&lt;P&gt;That is not autocasting. Autocasting happens when you pass objects to constructors or methods that will autocast objects to instances of classes. If you create a new instance of the WebStyleSymbol, you can use the clone method and more.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-WebStyleSymbol.html#methods-summary" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-WebStyleSymbol.html#methods-summary&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Mar 2022 15:31:04 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2022-03-02T15:31:04Z</dc:date>
    <item>
      <title>Create and clone WebStyleSymbol --&gt; Not a function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-and-clone-webstylesymbol-gt-not-a-function/m-p/1149488#M76543</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to create an instance of a WebStyleSymbol and then clone it to vary the height. However, I can't seem to find a way of doing so. When I try to autocast a symbol as WebStyleSymbol and then call it with e.g. fetchSymbol() or clone(), I get the "webStyleSymbol.clone is not a function" error. This leads me to believe that the casting itself somehow went wrong, even though the type is specified as "web-style".&lt;/P&gt;&lt;P&gt;I am not very proficient in Javascript or the ArcGIS API, so this might as well be some easy to avoid mistake Any help is appreciated. Find attached the minimum example to reproduce the error.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;meta charset="utf-8"&amp;gt;
  &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"&amp;gt;
  &amp;lt;title&amp;gt;Minimum working example&amp;lt;/title&amp;gt;
  &amp;lt;style&amp;gt;
    html, body, 
    #viewDiv {
      padding: 0;
      margin: 0;
      height: 100%;
      width: 100%;
      }
  &amp;lt;/style&amp;gt;

  &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.22/esri/themes/light/main.css"&amp;gt;
  &amp;lt;script src="https://js.arcgis.com/4.22/"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;script&amp;gt;
    require([
        "esri/config",
        "esri/symbols/WebStyleSymbol"
    ],(esriConfig, WebStyleSymbol)=&amp;gt; {

    //autocast new symbol
    let webStyleSymbol = {
      type: "web-style",
      styleName: "EsriInfrastructureStyle",
      name: "Wind_Turbine"
    };

    console.log(webStyleSymbol.type); //check the type --&amp;gt; output "web-style"
    webStyleSymbol.clone(); //clone the symbol --&amp;gt; this throws an error
    console.log(webStyleSymbol.type); //check again
    })
  &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 09:30:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-and-clone-webstylesymbol-gt-not-a-function/m-p/1149488#M76543</guid>
      <dc:creator>FriederHaag</dc:creator>
      <dc:date>2022-03-02T09:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: Create and clone WebStyleSymbol --&gt; Not a function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-and-clone-webstylesymbol-gt-not-a-function/m-p/1149613#M76547</link>
      <description>&lt;P&gt;That is not autocasting. Autocasting happens when you pass objects to constructors or methods that will autocast objects to instances of classes. If you create a new instance of the WebStyleSymbol, you can use the clone method and more.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-WebStyleSymbol.html#methods-summary" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-symbols-WebStyleSymbol.html#methods-summary&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 15:31:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-and-clone-webstylesymbol-gt-not-a-function/m-p/1149613#M76547</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-03-02T15:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: Create and clone WebStyleSymbol --&gt; Not a function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-and-clone-webstylesymbol-gt-not-a-function/m-p/1149643#M76549</link>
      <description>&lt;P&gt;Thank you! How would I autocast a WebStyleSymbol then? The example &lt;A href="https://developers.arcgis.com/javascript/latest/visualization/3d-visualization/visualizing-points-3d/" target="_self"&gt;here&lt;/A&gt; seems to be using what I tried.&lt;/P&gt;&lt;P&gt;In any case you were right that it did not create a WebStyleSymbol properly. I used this and it worked:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let webStyleSymbol = new WebStyleSymbol({
  styleName: "EsriInfrastructureStyle",
  name: "Wind_Turbine"
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 16:04:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-and-clone-webstylesymbol-gt-not-a-function/m-p/1149643#M76549</guid>
      <dc:creator>FriederHaag</dc:creator>
      <dc:date>2022-03-02T16:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Create and clone WebStyleSymbol --&gt; Not a function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-and-clone-webstylesymbol-gt-not-a-function/m-p/1149647#M76550</link>
      <description>&lt;P&gt;Glad you got it working!&lt;/P&gt;&lt;P&gt;In that example, the symbol object is added to the renderer of the layer. Under the hood, the renderer sees the object of the symbol passed to the setter, it will reactively create an instance of the symbol class based on the type property to the correct symbol instance. But the object has to be passed to something for that to happen.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 16:08:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-and-clone-webstylesymbol-gt-not-a-function/m-p/1149647#M76550</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-03-02T16:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: Create and clone WebStyleSymbol --&gt; Not a function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-and-clone-webstylesymbol-gt-not-a-function/m-p/1149658#M76551</link>
      <description>&lt;P&gt;I see, thanks for the explanation!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2022 16:18:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-and-clone-webstylesymbol-gt-not-a-function/m-p/1149658#M76551</guid>
      <dc:creator>FriederHaag</dc:creator>
      <dc:date>2022-03-02T16:18:09Z</dc:date>
    </item>
  </channel>
</rss>

