Select to view content in your preferred language

Lock/Constrain Extents Flexviewer 3.1

2936
6
Jump to solution
01-15-2013 05:44 AM
MarkHanway1
Emerging Contributor
I am using the latest 3.1 viewer and looking to secure the extent.   Disabling the left mouse function would be nice but I would like to constrain the extent similar to http://thunderhead.esri.com/readonlyurl/ExtentApp.html

Here is the full blogpost:
http://thunderheadxpler.blogspot.com/2009/01/constraining-map-extent.html

I know Robert Scheitlin expanded the example from Mansour Raad for an early version of the viewer in this post http://forums.esri.com/Thread.asp?c=158&f=2421&t=295234&mc=0

There are 2 files:

ConstrainedMap.as
MapManager.mxml

I haven't been successful getting this updated for 3.1 and was wondering if anyone has migrated the action script an updated changes to the mapmanager.mxml for the later versions of the viewer? 

Thanks,

Mark
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MatthewGoulet1
Deactivated User
Has anyone gotten the zoom in/out functionality to work with Mansour's/Robert's constraint code? Panning seems fine (I'm using Viewer 3.2), but whenever I zoom in or out, the map goes to it's full extent and "shakes" up and down.

Is the only solution to prevent zooming?

View solution in original post

0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Emeritus
Mark,

   Here is a more recent version for Flex Viewer 2.2 it may be easier to port over.

http://forums.arcgis.com/threads/20799-Restrict-View-Port-Bounds-in-Flex-Viewer-2.x?p=67595&viewfull...

I will see if I can find the time to do it for 3.1, but no promises.
0 Kudos
RhettZufelt
MVP Notable Contributor
Hi Robert,

I tried to incorporate this, and it seems that most ports fine.  However, it does not like the

m_initialScale = ProjUtils.convertExtentToScale(m_cExtent, width, height, Units.esri_internal::esriMeters);


and it gives me the following:

-1137: Incorrect number of arguments. Expected no more than 3.
-1119: Access of possibly undefined property esriMeters through a reference with static type Class.
-1119: Access of possibly undefined property esriMeters through a reference with static type Class.
-height

Looked through the api and don't see the that class in utils anymore, yet the autocomplete has it, but only wants 3 args.


Anyway, I'll keep looking try to figure it out, but thought I'd let you know that most of it comes across.

R_
0 Kudos
MarkHanway1
Emerging Contributor
Hi Rhett,

Did you have any trouble with Line 41?  const newScale:Number = ProjUtils.convertExtentToScale(value, width, height, Units.esri_internal::UNITS_METERS);

I had similar issues with line 41 and line 69 "Access of possibly undefined property esri_internal through a reference with static type Class"
0 Kudos
RhettZufelt
MVP Notable Contributor
Yep, both of them.  Still can't figure out how to convert an extent to scale now.

R_
0 Kudos
MatthewGoulet1
Deactivated User
Has anyone gotten the zoom in/out functionality to work with Mansour's/Robert's constraint code? Panning seems fine (I'm using Viewer 3.2), but whenever I zoom in or out, the map goes to it's full extent and "shakes" up and down.

Is the only solution to prevent zooming?
0 Kudos
NancyGnanicys
Deactivated User
I just downloaded the code provided at the site :
http://forums.esri.com/Thread.asp?c=158&f=2421&t=293364
However, I do not have a mapmanager.xml anywhere when I open the application folder.  Where do I put the MapManager.mxml or constrainedmap.as?  I'm using flex viewer 3.2 and not flash builder.  What do I do with this to get my map to constrain and "bounce" back in my application?
0 Kudos