I am using ArcGIS API for flex 2.4 with ArcGIS server 10. I am trying to write the widget where user can define the map scale (type it in text box) and it will zoom to that scale. I successfully created a widget. But When I type scale in the text box it still zooms to the nearest LOD scale level. e.g. if i zoom to 5000 scale, it will take it as 4,514.
Could anyone suggest what change I need to make? Is there anything that needs to be defined in MapManager?
<?xml version="1.0" encoding="utf-8"?>
<!--
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2010 ESRI
//
// All rights reserved under the copyright laws of the United States.
// You may freely redistribute and use this software, with or
// without modification, provided you include the original copyright
// and use restrictions. See use restrictions in the file:
// <install location>/License.txt
//
////////////////////////////////////////////////////////////////////////////////
-->
<viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:esri="http://www.esri.com/2008/ags"
xmlns:viewer="com.esri.viewer.*"
widgetConfigLoaded="init()">
<fx:Script>
<![CDATA[
//this function called when the widget's configuration is loaded
private function init():void
{
if (configXML) // checking for valid content in the configuration file
{
}
mapScaleObj.text = String(map.scale);
}
private function doScale():void
{
map.scale = Number(mapScaleObj.text);
mapScaleObj.text = String(mapScaleObj.text);
}
]]>
</fx:Script>
<viewer:WidgetTemplate id="helloWorld"
width="250" height="110">
<viewer:layout>
<s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
</viewer:layout>
<s:SkinnableContainer >
<s:HGroup>
<s:Label height="100%" color="#FFFFFF" fontSize="14" fontWeight="bold" text="Scale 1:"
verticalAlign="middle"/>
<s:TextInput id="mapScaleObj" text="{map.scale}"
restrict="0-9"
enter="doScale();"
/>
</s:HGroup>
</s:SkinnableContainer>
</viewer:WidgetTemplate>
</viewer:BaseWidget>