Select to view content in your preferred language

changing extent dynamically

903
3
05-19-2011 11:48 AM
SaugatJoshi
Deactivated User
Hi all,

I have 3 buttons in viewer.I have extents for each of these from the database..
Button 1- zooms to football field
button 2- zooms to university building, and
button 3- zooms to nearby police station.
Where can I change the code to achieve something like this in the same map? The initial extent will be the extent from button 1. What about other two extents.

Thank you.
Tags (2)
0 Kudos
3 Replies
SaugatJoshi
Deactivated User
Guys,I think I got it. Below is the code....I have my three extents in a combobox instead of Buttons. Below is the snippet


//changeView is the event listener for combo box's change property

private function changeView(event:Event):void
   {
    var viewExtent:Extent=new Extent(Number(bboxArray[0]), Number(bboxArray[1]), Number(bboxArray[2]), Number(bboxArray[3]), null);
    selectedExtent = viewExtent;
    map.extent=selectedExtent;
    //mx.controls.Alert.show(selectedView);
   }


bboxArray has xmin,ymin,xmax and ymax values respectively which I get from the database.Please don't forget to write if statements depending on you case.

Thanks.
0 Kudos
MohdShah
Deactivated User
Hello all
I try same code but
got this error


1046: Type was not found or was not a compile-time constant: Extent.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Mohd,

   That is a really BASIC programming concept... You need to import the extent type.

import com.esri.ags.geometry.Extent;
0 Kudos