Select to view content in your preferred language

redraw resize map when browser resized

1960
4
01-27-2011 07:22 AM
by Anonymous User
Not applicable
Original User: alnesbit

Hello all,

I have put a width of 100% on all of my components and containers and the text resizes and moves to a new line very nicely when the browser window is expanded and made smaller. My map does not resize though.

I swear I read something somewhere about how to do this but I can't find it now. Does anyone know what code I need to make the map resize and redraw when the browser window is resized?

Thanks in advance,
0 Kudos
4 Replies
by Anonymous User
Not applicable
Original User: cgishack

Is your map set to have a width/height of 100%, or have a top, left, bottom and right set to 0?

What type of container is the map in?
0 Kudos
by Anonymous User
Not applicable
Original User: alnesbit

My map is in a <s:VGroup> and that's within a <mx:VDividedBox>. The map and all containers are set to height and width = 100%.

Thanks,
0 Kudos
Drew
by
Frequent Contributor
Here is a sample that seems to work for me.

<?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" minWidth="955" minHeight="600" xmlns:esri="http://www.esri.com/2008/ags">
 <fx:Declarations>
  <!-- Place non-visual elements (e.g., services, value objects) here -->
 </fx:Declarations>



<mx:VDividedBox width="100%" height="100%">
 <s:VGroup width="100%">
 <mx:DataGrid id="myGrid" width="100%" height="100%" />
 </s:VGroup> 
 <s:VGroup width="100%">
  <esri:Map id="myMap" x="0" y="0">
   <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
  </esri:Map>
 </s:VGroup> 
 
</mx:VDividedBox>
</s:Application>


Drew
0 Kudos
by Anonymous User
Not applicable
Original User: alnesbit

Ok, I guess mine is working as it's supposed to. I didn't think it was but I think that's just the nature of a map within the website. If you expand the browser the map will expand to fill the space. If you have to make your browser window smaller, I thought it would try to fit your current view of the map into the now smaller map container. But it doesn't. It just cuts it off. But the sample does it too, so that's just how it is.

Appreciate your help,
0 Kudos