<?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: Converting a PictureMarkerSymbol to a swatch in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/converting-a-picturemarkersymbol-to-a-swatch/m-p/111224#M2608</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a utility function I use based on a lot what Robert Scheitlin did for his Legend tool that handles PictureMarkerSymbols as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/odoe/FlexMapTools/blob/master/src/net/odoe/FlexMapTools/factories/SwatchFactory.as"&gt;https://github.com/odoe/FlexMapTools/blob/master/src/net/odoe/FlexMapTools/factories/SwatchFactory.as&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Nov 2010 13:21:32 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2010-11-22T13:21:32Z</dc:date>
    <item>
      <title>Converting a PictureMarkerSymbol to a swatch</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/converting-a-picturemarkersymbol-to-a-swatch/m-p/111221#M2605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Using Flex API 1.3...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Based on posts from the previous forum, I wrote the following function to convert a map graphic to a swatch and add it to an InfoWindow:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;function createSwatchFromGraphic(g:Graphic,m:Map):UIComponent {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; var swatch:UIComponent = new UIComponent;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; var sym:Symbol = g.symbol;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; sym.draw(swatch, new MapPoint(), null, m);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; swatch.x = swatch.y = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; return swatch;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I use this for point markers; this function has worked great for simple markers and composite markers. However, it chokes on picture markers at the sym.draw function with a type coercion error - can't convert UIComponent to Graphic.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I thought since the symbol apparently is a UIComponent, I could cast the symbol as a picture marker symbol, transfer its height and width properties to the sprite, set the sprite's x/y to 0, and add the symbol as a child of the sprite...yeah, that didn't work either (null pointer exception when the child was added to the swatch).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any wisdom to impart?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Nov 2010 17:22:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/converting-a-picturemarkersymbol-to-a-swatch/m-p/111221#M2605</guid>
      <dc:creator>TyroneLigon</dc:creator>
      <dc:date>2010-11-19T17:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a PictureMarkerSymbol to a swatch</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/converting-a-picturemarkersymbol-to-a-swatch/m-p/111222#M2606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You could try just using a Flex Image to load the PictureMarkerSymbol's source.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Nov 2010 18:55:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/converting-a-picturemarkersymbol-to-a-swatch/m-p/111222#M2606</guid>
      <dc:creator>DasaPaddock</dc:creator>
      <dc:date>2010-11-19T18:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a PictureMarkerSymbol to a swatch</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/converting-a-picturemarkersymbol-to-a-swatch/m-p/111223#M2607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well DUH!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd be able to see the forest if all the trees weren't in the way.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So now, I determine if the graphic is a PictureMarkerSymbol - if so, I create an image object and use the graphic's source, otherwise I use the function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was just bent on forcing the issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, Dasa.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Nov 2010 19:28:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/converting-a-picturemarkersymbol-to-a-swatch/m-p/111223#M2607</guid>
      <dc:creator>TyroneLigon</dc:creator>
      <dc:date>2010-11-19T19:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Converting a PictureMarkerSymbol to a swatch</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/converting-a-picturemarkersymbol-to-a-swatch/m-p/111224#M2608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a utility function I use based on a lot what Robert Scheitlin did for his Legend tool that handles PictureMarkerSymbols as well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://github.com/odoe/FlexMapTools/blob/master/src/net/odoe/FlexMapTools/factories/SwatchFactory.as"&gt;https://github.com/odoe/FlexMapTools/blob/master/src/net/odoe/FlexMapTools/factories/SwatchFactory.as&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Nov 2010 13:21:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/converting-a-picturemarkersymbol-to-a-swatch/m-p/111224#M2608</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2010-11-22T13:21:32Z</dc:date>
    </item>
  </channel>
</rss>

