Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/07/2007, 12:26
WarXL
 
Fecha de Ingreso: julio-2007
Mensajes: 3
Antigüedad: 16 años, 9 meses
Puntos: 0
Ayuda por favor!!! Códigoooo

Antes de nada SALU2 a todos los forer@s.
Este es el código lo q hace es hacer zoom sobre un mapamundi (con su correspondiente cambio de cursor). Cuando pinchas sobre tierra (countryfill) hace zoom (+) y cuando haces click sobre agua hace zoom (-).
El caso es q quiero adaptar el codigo para q sea un zoom de ida y vuelta, es decir, haces click zoom (+) sobre el punto señalado y haces otro click y volverías al punto inicial un zoom (-) negativo.
Pero el caso es no tengo ni idea de actionscript, y no se si será dificil o no.
SALU2 MACANU2


pri_width = mc_map._width;
pri_height = mc_map._height;
pointer._visible = 0;
//--CAMBIO EL PUNTERO DEL MOUSE
//--EN 1 ES MAS Y EN 2 ES MENOS
mc_map.map.countryFill.onRollOver = function() {
Mouse.hide();
startDrag(pointer, true);
pointer.gotoAndStop(1);
pointer._visible = 1;
};
mc_map.map.seaFill.onRollOver = function() {
Mouse.hide();
startDrag(pointer, true);
pointer.gotoAndStop(2);
pointer._visible = 1;
};
mc_map.map.countryFill.onRollOut = function() {
Mouse.show();
stopDrag();
pointer._visible = 0;
};
mc_map.map.seaFill.onRollOut = function() {
Mouse.show();
stopDrag();
pointer._visible = 0;
};
//--CUANDO SE SUELTA EL BOTON DEL MOUSE SOBRE LA TIERRA
//--ZOOM(+) Y SE CENTRA EL PUNTO EN EL QUE SE HIZO CLICK
incremento = 1.2;
mc_map.map.countryFill.onRelease = function() {
esteX = this._parent._parent._parent._xmouse/pri_width;
esteY = this._parent._parent._parent._ymouse/pri_height;
esteXmap = this._parent._parent._xmouse/pri_width;
esteYmap = this._parent._parent._ymouse/pri_height;
// mc_map._x = (60+((1-esteXmap)*(mc_map._width*incremento)))-(mc_map._width*incremento);
limiteX = ((pri_width/2)+((1-esteXmap)*(this._parent._parent._width*incremento) ))-(this._parent._parent._width*incremento);
limiteY = ((pri_height/2)+((1-esteYmap)*(this._parent._parent._height*incremento )))-(this._parent._parent._height*incremento);
if (pri_width-(this._parent._parent._width*incremento)>limiteX) {
limiteX = pri_width-(this._parent._parent._width*incremento);
}
if (pri_height-(this._parent._parent._height*incremento)>limiteY) {
limiteY = pri_height-(this._parent._parent._height*incremento);
}
if (limiteX>0) {
limiteX = 0;
}
if (limiteY>0) {
limiteY = 0;
}
mover_mapa(this._parent._parent, (this._parent._parent._xscale*incremento), limiteX, limiteY);
trace(this._parent._parent._xscale*incremento);
};
//--CUANDO SE SUELTA EL BOTON DEL MOUSE SOBRE EL AGUA
//--ZOOM(-) Y SE CENTRA EL PUNTO EN EL QUE SE HIZO CLICK
mc_map.map.seaFill.onRelease = function() {
esteX = this._parent._parent._parent._xmouse/pri_width;
esteY = this._parent._parent._parent._ymouse/pri_height;
esteXmap = this._parent._parent._xmouse/pri_width;
esteYmap = this._parent._parent._ymouse/pri_height;
// mc_map._x = (60+((1-esteXmap)*(mc_map._width*incremento)))-(mc_map._width*incremento);
limiteX = ((pri_width/2)+((1-esteXmap)*(this._parent._parent._width/incremento)))-(this._parent._parent._width/incremento);
limiteY = ((pri_height/2)+((1-esteYmap)*(this._parent._parent._height/incremento)))-(this._parent._parent._height/incremento);
if (pri_width-(this._parent._parent._width/incremento)>limiteX) {
limiteX = pri_width-(this._parent._parent._width/incremento);
}
if (pri_height-(this._parent._parent._height/incremento)>limiteY) {
limiteY = pri_height-(this._parent._parent._height/incremento);
}
if (limiteX>0) {
limiteX = 0;
}
if (limiteY>0) {
limiteY = 0;
}
if (this._parent._parent._xscale/incremento>=100) {
trace(this._parent._parent._xscale/incremento);
mover_mapa(this._parent._parent, (this._parent._parent._xscale/incremento), limiteX, limiteY);
} else {
mover_mapa(this._parent._parent, 100, limiteX, limiteY);
}
};
//--FUNCION PARA HACER ZOOM Y CENTRAR EL MAPA
mover_mapa = function (mc_name, escala, x, y) {
trace(x+"=="+y);
mov_speed = 4;
mc_name.onEnterFrame = function() {
// if (this._x>x) {
// this._x += (x-this._x)/mov_speed;
// } else {
this._x += (x-this._x)/mov_speed;
// }
// if (this._y>y) {
// this._y += (y-this._y)/mov_speed;
// } else {
this._y += (y-this._y)/mov_speed;
// }
if (this._xscale<escala) {
if (this._xscale<(escala-(0.1+(escala-this._xscale)/mov_speed))) {
this._xscale = this._yscale += (escala-this._xscale)/mov_speed;
} else {
this._xscale = this._yscale=escala;
trace(this._xscale);
delete mc_name.onEnterFrame;
}
}
if (this._xscale>escala) {
if (this._xscale>escala+0.1) {
this._xscale = this._yscale -= (this._xscale-escala)/mov_speed;
} else {
this._xscale = this._yscale=escala;
trace(this._xscale);
delete mc_name.onEnterFrame;
}
}
};
};