<?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 Adding a Scale Bar to Flex Map Printing Utility? in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566441#M12760</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am working with the Flex Map Printing Utility from the sample gallery and I would like to add a scale bar to the footer.&amp;nbsp; Is it possible to create and display a scale bar if you have the map scale?&amp;nbsp; If it is possible can some one post example code of creating a scale bar?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 01 Jun 2010 20:51:12 GMT</pubDate>
    <dc:creator>RickyGonzalez</dc:creator>
    <dc:date>2010-06-01T20:51:12Z</dc:date>
    <item>
      <title>Adding a Scale Bar to Flex Map Printing Utility?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566441#M12760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am working with the Flex Map Printing Utility from the sample gallery and I would like to add a scale bar to the footer.&amp;nbsp; Is it possible to create and display a scale bar if you have the map scale?&amp;nbsp; If it is possible can some one post example code of creating a scale bar?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jun 2010 20:51:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566441#M12760</guid>
      <dc:creator>RickyGonzalez</dc:creator>
      <dc:date>2010-06-01T20:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a Scale Bar to Flex Map Printing Utility?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566442#M12761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;did you have any luck?&amp;nbsp; I'm hoping to print to scale using flex too&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jul 2010 17:12:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566442#M12761</guid>
      <dc:creator>JoshV</dc:creator>
      <dc:date>2010-07-15T17:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a Scale Bar to Flex Map Printing Utility?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566443#M12762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;did you have any luck?&amp;nbsp; I'm hoping to print to scale using flex too&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I did have some luck, but I didn't get the results I wanted.&amp;nbsp; Here is another thread I started with more information and screen shots &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/6228-PrintMapUtil-help-needed"&gt;http://forums.arcgis.com/threads/6228-PrintMapUtil-help-needed&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was told by someone who took the Flex training class this past weekend at the ESRI User Conference is that in Flex version 1 and Arc 9.3.x you are not able to reposition the scale bar, but in Flex version 2 and Arc 10 you are able to.&amp;nbsp; In my situation I think it will solve the problem whenever my system is upgraded.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jul 2010 17:44:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566443#M12762</guid>
      <dc:creator>RickyGonzalez</dc:creator>
      <dc:date>2010-07-15T17:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a Scale Bar to Flex Map Printing Utility?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566444#M12763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can make a new Scalebar, copy it's attributes and place it in the footer or anywhere else on your map. You'd need create a new scalebar skin, which I have not done yet, but ESRI provides the current skins with the API, which is a big help. This is because you need to scale the scalebar to the print page size and just setting the height/width doesn't work. Granted, I have not gotten this far though, so not sure.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To copy the scalebar, you can do something like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var i:uint = 0;
var x:uint = map.staticLayer.numChildren;
for (i; i &amp;lt; x; i++) {
 trace("What is this object? {0}", map.staticLayer.getChildAt(i));
 if (map.staticLayer.getChildAt(i) is ScaleBar) {
&amp;nbsp; trace("found the scale bar!");
&amp;nbsp; var s:ScaleBar = new ScaleBar();
&amp;nbsp; s.map = (map.staticLayer.getChildAt(i) as ScaleBar).map;
&amp;nbsp; s.lengthMetric = (map.staticLayer.getChildAt(i) as ScaleBar).lengthMetric;
&amp;nbsp; s.lengthUS = (map.staticLayer.getChildAt(i) as ScaleBar).lengthUS;
&amp;nbsp; s.textMetric = (map.staticLayer.getChildAt(i) as ScaleBar).textMetric;
&amp;nbsp; s.textUS = (map.staticLayer.getChildAt(i) as ScaleBar).textUS;
&amp;nbsp; // you can adjust the bottom/left/top/right values of the map scalebar too
&amp;nbsp; s.bottom = 25;
&amp;nbsp; s.left = 5;
&amp;nbsp; this.addElement(s);
 }
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I copied the attributes of the scalebar, rather than copy it because if I do change the skin or figure out how to scale it, passing it would be reflected in the scalebar on the map, so make sure you copy it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That's as far as I've gotten so far. I'd love to hear some other solutions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;edited, because yes, you can capture the scalebar, it's just tricky as Ricky showed above because of the size of the browser window.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok, so I figured out how to move the scalebar before the image of the map is captured.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
map.zoomSliderVisible = false;
map.addEventListener(FlexEvent.UPDATE_COMPLETE, onUpdateComplete_handler);
var i:uint = 0;
var x:uint = map.staticLayer.numChildren;
for (i; i &amp;lt; x; i++) {
 trace("What is this object? {0}", map.staticLayer.getChildAt(i));
 if (map.staticLayer.getChildAt(i) is ScaleBar) {
&amp;nbsp; trace("found the scale bar! left =", (map.staticLayer.getChildAt(i) as ScaleBar).left);
&amp;nbsp; // move it into a position that works for you
&amp;nbsp; (map.staticLayer.getChildAt(i) as ScaleBar).left += 200;
 }
}
function onUpdateComplete_handler(e:FlexEvent):void {
 map.removeEventListener(FlexEvent.UPDATE_COMPLETE, onUpdateComplete_handler);
 mapImage.source = PrintMapUtil.trimmedMap(map, mapImage.width, mapImage.height);
 var j:uint = 0;
 for (j; j &amp;lt; x; j++) {
&amp;nbsp; trace("What is this object? {0}", map.staticLayer.getChildAt(j));
&amp;nbsp; if (map.staticLayer.getChildAt(j) is ScaleBar) {
&amp;nbsp;&amp;nbsp; // move it back, 5 is the default
&amp;nbsp;&amp;nbsp; (map.staticLayer.getChildAt(j) as ScaleBar).left = 5;
&amp;nbsp; }
 }
 map.zoomSliderVisible = true;
}

That's tested and works with PrintMapUtil and API2.0.
Well, that was fun, now back to work.
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:24:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566444#M12763</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-12-12T00:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a Scale Bar to Flex Map Printing Utility?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566445#M12764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Version 2 of the API still supports ArcGIS Server 9.3. Also, in version 2, you can now place the ScaleBar like any other component outside of the Map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;e.g.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:s="library://ns.adobe.com/flex/spark"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:mx="library://ns.adobe.com/flex/mx"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:esri="http://www.esri.com/2008/ags"&amp;gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;s:layout&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;s:VerticalLayout horizontalAlign="center"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/s:layout&amp;gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:Map id="map" scaleBarVisible="false"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/esri:Map&amp;gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:ScaleBar map="{map}"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;lt;/s:Application&amp;gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:24:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566445#M12764</guid>
      <dc:creator>DasaPaddock</dc:creator>
      <dc:date>2021-12-12T00:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a Scale Bar to Flex Map Printing Utility?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566446#M12765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, that's much simpler than my initial approach &lt;span class="lia-unicode-emoji" title=":face_with_open_mouth:"&gt;😮&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In my example above, it's probably simpler making your own ScaleBar, add it to the StaticLayer, print, then remove it. Probably three extra lines of code as opposed to that massive loop I had.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dasa, if I wanted to change the size of the scalebar used outside the map, that can be done with a new Skin correct?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Jul 2010 18:25:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566446#M12765</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2010-07-16T18:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a Scale Bar to Flex Map Printing Utility?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566447#M12766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Has anybody had success skinning the scale bar?&amp;nbsp; When I try to create a new MXML Skin as a copy of com.esri.ags.skins.ScaleBarSkin, I get the error: "The source for the skin "{0}" cannot be found."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, I'm having trouble setting the lengthUS, lengthMetric, and width properties.&amp;nbsp; It seems as if the scalebar component doesn't respect those properties at all.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 May 2011 21:26:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566447#M12766</guid>
      <dc:creator>MichaelHaggerty</dc:creator>
      <dc:date>2011-05-18T21:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a Scale Bar to Flex Map Printing Utility?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566448#M12767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Has anybody had success skinning the scale bar?&amp;nbsp; When I try to create a new MXML Skin as a copy of com.esri.ags.skins.ScaleBarSkin, I get the error: "The source for the skin "{0}" cannot be found."&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You need to configure your Flash builder. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Look at Dasa's post here: &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/28487-PopUps#10"&gt;http://forums.arcgis.com/threads/28487-PopUps#10&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also see Custom scalebar skin sampel at:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=ScaleBarSample"&gt;http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=ScaleBarSample&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 May 2011 21:41:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566448#M12767</guid>
      <dc:creator>MehulChoksey</dc:creator>
      <dc:date>2011-05-18T21:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a Scale Bar to Flex Map Printing Utility?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566449#M12768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Robert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My Query is i want to print a scale par in my report. This scale bar will be taking the current scale details of my map. The problem is that i have created a report to print and i need to show the scale-bar in this report. how can i achieve this..?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for reference my report page is attached below.. and the Red box indicates the place where i need a scale-bar..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Anshul&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2011 13:50:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/adding-a-scale-bar-to-flex-map-printing-utility/m-p/566449#M12768</guid>
      <dc:creator>AnshulMantri1</dc:creator>
      <dc:date>2011-09-27T13:50:29Z</dc:date>
    </item>
  </channel>
</rss>

