I recently did something similar. It's not perfect, but here is how I approached it:Make the initial map lined up with the widget in config.xml. for example, if you want a left-hand-side widget that collapses, set its left=0 and then set the map's left to the widget's width: <map initialextent="-14225000 1864000 -6525000 6658000" left="350" top="0" zoomslidervisible="false">
<widget left="0" top="0" width="350" config="widgets/MyCollapsibleWidget/MyCollapsibleWidget.xml" url="widgets/MyCollapsibleWidget/MyCollapsibleWidget.swf"/>
This will cause the map and widget to be lined up right next to each other. In your widget's MXML code, when you transition between your "open" and "closed" states, update the map's left also: <s:states>
<s:State name="normal" />
<s:State name="collapsed" />
</s:states>
<s:transitions>
<s:Transition fromState="normal" toState="collapsed">
<s:Resize target="{mainPartOfYourCollapsibleWidget}" duration="450" effectUpdate="moveTheMap(event)" />
</s:Transition>
<s:Transition fromState="collapsed" toState="normal">
<s:Resize target="{mainPartOfYourCollapsibleWidget}" duration="450" effectUpdate="moveTheMap(event)" />
</s:Transition>
</s:transitions>This effectUpdate handler function gets called repeatedly during the resize animation, and will make the map grow as the collapsible widget shrinks:private function moveTheMap(evt:EffectEvent):void{
ViewerContainer.getInstance().mapManager.left = mainContainer.width
} The nice thing about that is that you don't need separate handlers for each state, the map will just follow the width of the widget. This isn't perfect, it runs a little slowly and the map tends to re-center as it resizes. I think this may be solvable by watching for an extent change or similar event and re-positioning, but I need to explore it more.