Código :
#include "movimientos.as"
sententido = cuanto=2
mano = dir =false;
scale =100;
finalx=finaly=500
ecuacion="easeInOutQuad";
vel = 30;
Mouse.hide();
MovieClip.prototype.dibujaRectangulo = function(width, height, x, y) {
this.moveTo(x, y);
this.lineTo(width, y);
this.lineTo(width, height);
this.lineTo(x, height);
this.lineTo(x, y);
};
function escalar (xReceptor,yReceptor,xOriginal,yOriginal,rellenar) {
var xscale = xReceptor/xOriginal;
var yscale = yReceptor/yOriginal;
if (rellenar) return Math.max(xscale,yscale)* 100;
else return Math.min(xscale,yscale)* 100;
};
cuad=mapa.foto.createEmptyMovieClip("cuadrado", 1);
//----------------------------------------------------------------------------
// ZOOM
//----------------------------------------------------------------------------
mapa.onPress = function() {
if(mano){
this.startDrag();
}else{
this.inix = this.foto._xmouse;
this.iniy = this.foto._ymouse;
this.onEnterFrame = function() {
cuad.clear();
cuad.lineStyle(.4, 0xffffff,50);
cuad.dibujaRectangulo(this.foto._xmouse, this.foto._ymouse,
this.inix, this.iniy);
};
};
};
mapa.onRelease = mapa.onReleaseOutside= function() {
if(mano){
this.stopDrag();
}else{
this.inix = Math.min(this.inix,this.foto._xmouse);
this.iniy = Math.min(this.iniy,this.foto._ymouse);
delete this.onEnterFrame;
if (cuad._width*scale/100>10 || cuad._height*scale/100>10){
this.foto.mover(ecuacion, vel, 0, {
_x:-this.inix-(cuad._width/2),
_y:-this.iniy-(cuad._height/2)
});
scale=escalar(finalx,finaly,cuad._width,cuad._height);
this.mover(ecuacion, vel, 0, {
_xscale:scale , _yscale:scale,
_x:finalx/2, _y:finaly/2
},
function(){cuad.clear();});
}else{
cuad.clear();
scale *= sententido;
this.foto.mover(ecuacion, vel, 0, {
_x:-this.foto._xmouse,
_y:-this.foto._ymouse
});
this.mover(ecuacion, vel, 0, {
//aplicamos scale
_xscale:scale , _yscale:scale,
_x:this._parent._xmouse, _y:this._parent._ymouse
});
}
}
};
//----------------------------------------------------------------------------
// lupa
//----------------------------------------------------------------------------
function verLupa(){
if(!mano){
_root.lupa._visible = true;
Mouse.hide();
_root.onMouseMove = function() {
_root.lupa.moverIni({_x:this._xmouse, _y:this._ymouse});
updateAfterEvent();
};
}
};
function esconderLupa(){
_root.lupa._visible = false;
Mouse.show();
delete _root.onMouseMove ;
};
verLupa();
Usa la etiqueta de código cuando pongas código
