Comunidad de diseño web y desarrollo en internet online

Problemón con el Zoom Código

Citar            
MensajeEscrito el 03 Dic 2005 05:00 pm
Gracias por atender a mi petición!!!
Este es el código que baje de sus ejemplos mas las modificaciones q realicé.
agregó la variable de restaurar que solo tendra como finalidad
detener el drag, esconder la lupa y mostrar el mouse para
que yo pueda dar clic sobre alguna parte de mi mapa

Código :

//----------------------------------------------------------------------------
//                           Inicio
//----------------------------------------------------------------------------
#include "movimientos.as"
sententido = cuanto=2
restaurar = 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){
        trace("Arrastar la mano onPress")
      this.startDrag();
   }
        //Nuevo
        else if(restaurar){
                
                Show.mouse();
        }

        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();
   }
        //Nuevo
        else if(restaurar){
                Show.mouse();
        }
        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{
                        trace("mas adentrito")
         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
//----------------------------------------------------------------------------
// paso de explicar esto...
function verLupa(){
   if(!mano){
                 if(!restaurar){
             _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();

//----------------------------------------------------------------------------
//                           botones 
//----------------------------------------------------------------------------

btZoom.onPress = function() {
   if (mano) {
      btMano.activado = mano=false;
      btMano._alpha = 100;
      btRestaurar._alpha  = 100;
   } else {
      if (dir) sententido = cuanto;
      else sententido = 1/cuanto;
      dir = !dir;
      this.gotoAndStop(dir+1);
      this._parent.lupa.gotoAndStop(dir+1);
   }
};
btMano.onPress = function() {
   this.activado = !this.activado;
   if (this.activado) {
      mano = true;
      esconderLupa();
      this._alpha = 50;
   } else {
      mano = false;
      verLupa();
      this._alpha = 100;
   }
};
//Esta la agregue y lo q pretendo es colocar una opción mas donde
//oculte la lupa y muestre el mouse
btRestaurar.onPress = function() {
        this.activado = !this.activado;
        if (this.activado){
            restaurar = true;
            esconderLupa();
            this._alpha = 50;
        }
        else{
             restaurar = false;
             verLupa();
             this._alpha  = 100;
        }
};

//zona de descanso de la lupa 
barPepe.onRollOver=function() {
   esconderLupa();
   this.useHandCursor = false;
}
barPepe.onRollOut = verLupa;
btMano.onRollOver=esconderLupa;
btMano.onRollOut = verLupa;
btZoom.onRollOver=esconderLupa;
btZoom.onRollOut = verLupa;
btRestaurar.onRollOver = esconderLupa;
//----------------------------------------------------------------------------
//                           reset 
//----------------------------------------------------------------------------
btReset.onRollOver=esconderLupa;
btReset.onRollOut = verLupa;
btReset.onPress = function() {
   trace(this._parent.mapa._x+" - "+this._parent.mapa._y)
   this._parent.mapa.foto.mover(ecuacion, vel, 0, {
                  _x:0,
                  _y:0
                  });
   this._parent.mapa.mover(ecuacion, vel, 0, {
                  _xscale:scale=100 , _yscale:100,
                  _x:250, _y: 150
                  });
};
//----------------------------------------------------------------------------
//                                                                imprimir
//----------------------------------------------------------------------------
btImprimir.onRollOver = esconderLupa;
btImprimir.onRollOut = verLupa;
btImprimir.onPress = function() {
             trace("tendre q imprimir");
          printAsBitmap(mapa,"bmovie")


};


Ahora dentro de foto selecciono cierta area, y la creo como un botón y coloco el siguiente código:

Código :

on (release) {
   getURL("javascript:var ventana = window.open('mapa.asp?mpio=40','_blank','width=650,height=400,location=0,directories=0,scrollbars=1,resizable=1'); ventana.moveTo(100,150)");
}


y esto último es lo que no me responde!!! :crap:

y ya intente llamarlo desde las acciones de la primera línea del tiempo, donde esta el código q anexo primero, pero no me responde ....

q puedo hacer... ya que el onpress deberá pasar por mapa, foto y ejecutar lo del on(release),pero antes ya existe un on press y on release de mapa??? estoy utilizando flash mx pro 2004.

no me desampares!!!!!! :crap: :cry:

Por lilian

3 de clabLevel



Genero:Masculino  

msie
Citar            
MensajeEscrito el 19 Dic 2005 11:02 pm
Este es el código que baje de sus ejemplos mas las modificaciones q realicé.
agregó la variable de restaurar que solo tendra como finalidad
detener el drag, esconder la lupa y mostrar el mouse para
que yo pueda dar clic sobre alguna parte de mi mapa

Código :

//---------------------------------------------------------------------------- 
// Inicio 
//---------------------------------------------------------------------------- 
#include "movimientos.as" 
sententido = cuanto=2 
restaurar = 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){ 
trace("Arrastar la mano onPress") 
this.startDrag(); 
} 
//Nuevo 
else if(restaurar){ 

Show.mouse(); 
} 

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(); 
} 
//Nuevo 
else if(restaurar){ 
Show.mouse(); 
} 
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{ 
trace("mas adentrito") 
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 
//---------------------------------------------------------------------------- 
// paso de explicar esto... 
function verLupa(){ 
if(!mano){ 
if(!restaurar){ 
_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(); 

//---------------------------------------------------------------------------- 
// botones 
//---------------------------------------------------------------------------- 

btZoom.onPress = function() { 
if (mano) { 
btMano.activado = mano=false; 
btMano._alpha = 100; 
btRestaurar._alpha = 100; 
} else { 
if (dir) sententido = cuanto; 
else sententido = 1/cuanto; 
dir = !dir; 
this.gotoAndStop(dir+1); 
this._parent.lupa.gotoAndStop(dir+1); 
} 
}; 
btMano.onPress = function() { 
this.activado = !this.activado; 
if (this.activado) { 
mano = true; 
esconderLupa(); 
this._alpha = 50; 
} else { 
mano = false; 
verLupa(); 
this._alpha = 100; 
} 
}; 
//Esta la agregue y lo q pretendo es colocar una opción mas donde 
//oculte la lupa y muestre el mouse 
btRestaurar.onPress = function() { 
this.activado = !this.activado; 
if (this.activado){ 
restaurar = true; 
esconderLupa(); 
this._alpha = 50; 
} 
else{ 
restaurar = false; 
verLupa(); 
this._alpha = 100; 
} 
}; 

//zona de descanso de la lupa 
barPepe.onRollOver=function() { 
esconderLupa(); 
this.useHandCursor = false; 
} 
barPepe.onRollOut = verLupa; 
btMano.onRollOver=esconderLupa; 
btMano.onRollOut = verLupa; 
btZoom.onRollOver=esconderLupa; 
btZoom.onRollOut = verLupa; 
btRestaurar.onRollOver = esconderLupa; 
//---------------------------------------------------------------------------- 
// reset 
//---------------------------------------------------------------------------- 
btReset.onRollOver=esconderLupa; 
btReset.onRollOut = verLupa; 
btReset.onPress = function() { 
trace(this._parent.mapa._x+" - "+this._parent.mapa._y) 
this._parent.mapa.foto.mover(ecuacion, vel, 0, { 
_x:0, 
_y:0 
}); 
this._parent.mapa.mover(ecuacion, vel, 0, { 
_xscale:scale=100 , _yscale:100, 
_x:250, _y: 150 
}); 
}; 
//---------------------------------------------------------------------------- 
// imprimir 
//---------------------------------------------------------------------------- 
btImprimir.onRollOver = esconderLupa; 
btImprimir.onRollOut = verLupa; 
btImprimir.onPress = function() { 
trace("tendre q imprimir"); 
printAsBitmap(mapa,"bmovie") 


}; 


Ahora dentro de foto selecciono cierta area, y la creo como un botón y coloco el siguiente código:

Código :

on (release) { 
   getURL("javascript:var ventana = window.open('mapa.asp?mpio=40','_blank','width=650,height=400,location=0,directories=0,scrollbars=1,resizable=1'); ventana.moveTo(100,150)"); 
}

y esto último es lo que no me responde!!!

y ya intente llamarlo desde las acciones de la primera línea del tiempo, donde esta el código q anexo primero, pero no me responde ....

q puedo hacer... ya que el onpress deberá pasar por mapa, foto y ejecutar lo del on(release),pero antes ya existe un on press y on release de mapa??? estoy utilizando flash mx pro 2004.

no me desampares!!!!!!

[moderador]agregada etiquetas code[/moderador]

Por lilian

3 de clabLevel



Genero:Masculino  

msie

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.