# Reverse Zoom Out Script

**URL:** https://forum.kirupa.com/t/reverse-zoom-out-script/189118
**Category:** flash
**Created:** [May 13, 2006, 11:13pm UTC](https://forum.kirupa.com/t/reverse-zoom-out-script/189118 "2006-05-13T23:13:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Tyg3r](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tyg3r/32/1341_2.png) [@Tyg3r](https://forum.kirupa.com/u/Tyg3r)
#### Post date: [May 13, 2006, 11:13pm UTC](https://forum.kirupa.com/t/reverse-zoom-out-script/189118/1 "2006-05-13T23:13:44Z")

</div>

I found this great script from [HERE](http://www.kirupa.com/forum/showthread.php?t=203137&highlight=zoom+map).

But the problem Im having is reversing it.

[AS]stateArray = new Array(“state01”, “state02”, “state03”, “state04”, “state05”);  
for (i=0; i\<stateArray.length; i++) {  
map[stateArray\*].onRollOver = function() {  
\_root.zoomToState(this.\_x, this.\_y, this.\_height, this.\_width);  
};  
}  
targetX = Stage.width/2;  
targetY = Stage.height/2;  
targetW = Stage.width-50;  
targetH = Stage.height-50;  
function zoomToState(stateX, stateY, stateH, stateW) {  
stateScale = targetW/stateW;  
if (stateScale_stateH\>targetH) {  
stateScale = targetH/stateH;  
}  
mapX = targetX-(stateX_stateScale);  
mapY = targetY-(stateY_stateScale);  
\_root.onEnterFrame = function() {  
map.\_x -= (map.\_x-mapX)/3;  
map.\_y -= (map.\_y-mapY)/3;  
map.\_xscale -= (map.\_xscale-(stateScale_100))/3;  
map.\_yscale -= (map.\_yscale-(stateScale_100))/3;  
if (Math.abs(map.\_x-mapX)\<.5 && Math.abs(map.\_y-mapY)\<.5 && Math.abs(map.\_xscale-(stateScale_100))\<.5) {  
delete (\_root.onEnterFrame);  
}  
};  
}  
[/AS]

[COLOR=#000000]I’ve changed it so that the zoom action takes place on a RollOver (not Release). I wanted it to zoom back to its original state on RollOut.[/COLOR]

[COLOR=#000000]Here is my slightly adjusted version so far.[/COLOR]
