el zoom in funciona perfecto, lo que no logro hacer es el zoom out. pues consegui un codigo que posteo al final que es para crear un boton, pero no me funciona, donde podria estar el error?
el codigo es este:
Código :
incremento = 1.1; function zoom(x,y,ancho,alto, aceleracion) { mapa.onEnterFrame = function() { this._x += (x-this._x)/aceleracion; this._y += (y-this._y)/aceleracion; this._width += (ancho-this._width)/aceleracion; this._height+= (alto-this._height)/aceleracion; if (Math.abs(x-this._x)<0.5 && Math.abs(y-this._y)<0.5 && Math.abs(ancho-this._width)<0.5 && Math.abs(alto-this._height)<0.5) { this._x = x; this._y = y; this._width = ancho; this._height = alto; delete this.onEnterFrame; } }; }; onMouseDown =function(){ if (mapa.hitTest(_xmouse,_ymouse)){ Alto = incremento*mapa._height; Ancho = incremento*mapa._width; x = _xmouse-((_xmouse-mapa._x) * incremento); y= _ymouse-((_ymouse-mapa._y) * incremento); zoom(x,y,Ancho,Alto,1.1); } };
codigo para el boton de alejar o zoom out
Código :
on (press) { if (_root.pages.hitTest(_xmouse,_ymouse)){ Alto = _root.pages._height / _root.incremento; //—ZoomOut Ancho = _root.pages._width /_root.incremento; //——ZoomOut x = _xmouse-((_xmouse-_root.pages._x) * _root.incremento); y= _ymouse-((_ymouse-_root.pages._y) * _root.incremento); _root.zoomIn(x,y,Ancho,Alto,3); } };