Comunidad de diseño web y desarrollo en internet online

Problema con una funcion

Citar            
MensajeEscrito el 14 Sep 2007 01:26 pm
Hola, estoy tratando de hacer una funcion que cuando el usuario haga un RollOver a un mc, este mc crezca en un 10% y al rollout disminuya el 10%. Cuando paso por encima, no se mueve, pero no tanto como cuando uso la funcion directamente, quizas la estoy llamando mal.

Tengo lo siguiente:

Para acercar

Código :

function acerca(ancho:Number, largo:Number, ypos:Number) {
   if (this._width<((ancho)*1.1) && this._height<((largo)*1.1) && this._y<(ypos+30)) {
      this._y -= 2;
      this._width += 1;
      this._height += 1;
   }
}


y para alejar

Código :

function aleja(ancho:Number, largo:Number, ypos:Number) {
   if (this._width>ancho && this._height>largo && this._y<(ypos)) {
      this._y += 2;
      this._width -= 1;
      this._height -= 1;
   }
}


y para llamarlas

Código :

intro_btn.onRollOver = function() {
   this.onEnterFrame = acerca(80,65,161);
};

intro_btn.onRollOut = function() {
   this.onEnterFrame = aleja(80,65,161);
};


Cuando paso por encima, no se mueve, pero no tanto como cuando uso la funcion directamente.

Código :

inicio_btn.onRollOver = function() {
   ancho = 60;
   largo = 65;
   ypos = 161;
   this.onEnterFrame = function() {
      if (this._width<((ancho)*1.1) && this._height<((largo)*1.1) && this._y<(ypos+30)) {
         this._y -= 2;
         this._width += 1;
         this._height += 1;
      }
   };
};


Ojala puedan ayudarme!

Gracias!

Por JavierS

37 de clabLevel



Genero:Masculino  

Viña/Chile

firefox
Citar            
MensajeEscrito el 14 Sep 2007 02:40 pm
SI estan mal llamadas las funciones acerca y aleja, corrige tu codigo así:

Código :

function acerca() {
   if (this._width<((this.ancho)*1.1) && this._height<((this.largo)*1.1) && this._y<(this.ypos+30)) {
      this._y -= 2;
      this._width += 1;
      this._height += 1;
   }
}

function aleja() {
   if (this._width>this.ancho && this._height>this.largo && this._y<(this.ypos)) {
      this._y += 2;
      this._width -= 1;
      this._height -= 1;
   }
}

inicio_btn.onRollOver = function() {
   this.ancho = 80;
   this.largo = 65;
   this.ypos = 161;
   this.onEnterFrame = acerca; // sin parentesis ni parametros
};
inicio_btn.onRollOut = function() {
   this.ancho = 80;
   this.largo = 65;
   this.ypos = 161;
   this.onEnterFrame = aleja; // sin parentesis ni parametros
};

Por gabynufe

Claber

446 de clabLevel



 

México, D.F.

msie7
Citar            
MensajeEscrito el 14 Sep 2007 05:00 pm
muchas gracias!!!

Por JavierS

37 de clabLevel



Genero:Masculino  

Viña/Chile

firefox
Citar            
MensajeEscrito el 14 Sep 2007 05:30 pm
Te funciono?

Por gabynufe

Claber

446 de clabLevel



 

México, D.F.

msie7
Citar            
MensajeEscrito el 15 Sep 2007 11:13 am
Si, a la perfeccion, aunq tengo un problema, un de los botones no me funciona, extrañamente. Pero bueno ahi lo vere.

Muchas gracias por la ayuda.

Por JavierS

37 de clabLevel



Genero:Masculino  

Viña/Chile

msie

 

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