Select to view content in your preferred language

Constrained Map Extent in Flex

1455
3
10-25-2010 03:05 PM
SandeepTalasila
Occasional Contributor
Hi,
Does anyone know how to apply constrained Map Extent in Flex Viewer 2.1. I found one implemented on Sample Flex Viewer 1.3. http://forums.esri.com/Thread.asp?c=158&f=2421&t=295234&mc=0. But not sure how to apply in 2.1, getting so many errors.
Thanks.
Tags (2)
0 Kudos
3 Replies
MattWilliams
Emerging Contributor
Not sure if this will help you or not. This is the sample code on Mansour's blog, before it was modified for the FSV 1.3.

http://thunderheadxpler.blogspot.com/2009/01/constraining-map-extent.html

The only change I had to make to the SampleMap.as file was on line 65...
WAS: if( extent.containsExtent( m_initialExtent ))
NOW: if( extent.contains( m_initialExtent ))

Then the mxml looks something like this:
<?xml version="1.0" encoding="utf-8"?>
<s:Application 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:sample="com.esri.sample.*">

 <sample:SampleMap>
  <sample:extent>
   <esri:Extent xmin="-92.957" ymin="37.674" xmax="-84.729" ymax="42.541" id="myMapExtent">
    <esri:SpatialReference wkid="4326"/>
   </esri:Extent>
  </sample:extent>
  <esri:ArcGISTiledMapServiceLayer  
   url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/>
 </sample:SampleMap>
 
</s:Application>


Like I said, not sure if this will help you or not... Good Luck!
0 Kudos
MattiasEkström
Frequent Contributor
I would like this in my Flex Viewer 2.1 too, I actually tried rewriting Roberts implemetation for the SFV 1.3 to the Flex Viewer 2.1. I managed to get rid of all errors, but when I ran the application there wasn't a map at all, all was blank, that's were I gave up.
It will need a lot more modifications than changing extent.containsExtent to extent.contains, to apply this to the FlexViewer 2.1 that's for sure 🙂
0 Kudos
SandeepTalasila
Occasional Contributor
Hey Mattias,
I did those changes too... and I am having the same problem as you do... nothing shows up.

@Matt Williams: Thanks for your response.
0 Kudos