Comunidad de diseño web y desarrollo en internet online

¿Esto es posible?

Citar            
MensajeEscrito el 22 Nov 2007 09:07 pm
Disculpen si no puse un titulo adecuado pero no supe cual poner.

Tengo el siguiente problema:

1. Tengo 7 botones a los cuales tengo que darles el mismo efecto esto lo estoy haciendo con un for
2 Dentro de estos botones hay un clip en el cual mando llamar una fotografia a la cual le aplico una funcion.

Estoy tratando de hacer esto:

Código :

this["btn_foto"+m].this["conte_foto"+n].luz("in",1);


3. luz es una funcion del tipo prototype

Al correr esto me marca un error que me hace falta un valor despues de "."

Como puedo hacer para que esto sea posible

Por sfa

72 de clabLevel



 

Mexico DF

firefox
Citar            
MensajeEscrito el 23 Nov 2007 03:55 pm

Código :

this["btn_foto"+m]["conte_foto"+n].luz("in",1);

si dentro de cada boton tienes un movie clip llamado "conte_foto" mas el mismo consecutivo que tiene el boton, entonces cambia "+n" por "+m".
o si dentro de cada boton tienes un movieclip llamado "conte_foto" sin ningún consecutivo, entonces tu codigo debe ser:

Código :

this["btn_foto"+m].conte_foto.luz("in",1);

Por gabynufe

Claber

446 de clabLevel



 

México, D.F.

msie7
Citar            
MensajeEscrito el 23 Nov 2007 04:29 pm
De hecho si hay consecutivo en ambos clip pero no son los mismos.
l=1,4,7,10,13,16,19
m= 3,6,9,12,15,18,21
n=2,5,8,11,14,17,20

en realidad es este codigo el que teno pero hago lo mismo para todas:

Código :

btn_foto3.onRollOver=function(){
   var camara:Sound= new Sound();
   camara.attachSound("Camera");
   camara.setVolume(100);
   camara.start();
   
   btn_foto3.conte_foto2.luz("in",1);
   marco_foto1.swapDepths(22);
   btn_foto3.swapDepths(24);
   conte_foto2.swapDepths(23);
   
}

btn_foto3.onRollOut=function(){
      stopAllSounds();
   marco_foto1.swapDepths(1);
   btn_foto3.swapDepths(3);
   conte_foto2.swapDepths(2);
   var trans:Transform= new Transform(btn_foto3.conte_foto2);
   var gris:ColorTransform= new ColorTransform(1,1,1,1,-30,-30,-30,-120);
   trans.colorTransform=gris;
}
      

este codigo trabaja correctamente. Pero imaginate hacer esto mismo para 7 más. No es optimo. Asi estoy ahorita :twisted: en que segun yo debe funcionar y cuando corres el swf falla.

Espero y me puedan ayudar.

Por sfa

72 de clabLevel



 

Mexico DF

firefox
Citar            
MensajeEscrito el 23 Nov 2007 05:09 pm
¿dentro de cada boton tienes varias fotos? ¿o solo una?

Por gabynufe

Claber

446 de clabLevel



 

México, D.F.

msie7
Citar            
MensajeEscrito el 23 Nov 2007 05:38 pm
Varias fotos. Mira voy a colocar el codigo que quiero simplificar. Es una groseria pero...

Código :

btn_foto3.onRollOver=function(){
   var camara:Sound= new Sound();
   camara.attachSound("Camera");
   camara.setVolume(100);
   camara.start();
   
   btn_foto3.conte_foto2.luz("in",1);
   marco_foto1.swapDepths(22);
   btn_foto3.swapDepths(24);
   conte_foto2.swapDepths(23);
   
}

btn_foto3.onRollOut=function(){
      stopAllSounds();
   marco_foto1.swapDepths(1);
   btn_foto3.swapDepths(3);
   conte_foto2.swapDepths(2);
   var trans:Transform= new Transform(btn_foto3.conte_foto2);
   var gris:ColorTransform= new ColorTransform(1,1,1,1,-30,-30,-30,-120);
   trans.colorTransform=gris;
}
      

//----------------------------------------------
//----------------------------------------------

btn_foto6.onRollOver=function(){
   var camara:Sound= new Sound();
   camara.attachSound("Camera");
   camara.setVolume(100);
   camara.start();
   
   btn_foto6.conte_foto5.luz("in",1);
   marco_foto4.swapDepths(22);
   btn_foto6.swapDepths(24);
   conte_foto5.swapDepths(23);
}

btn_foto6.onRollOut=function(){
      stopAllSounds();
marco_foto4.swapDepths(4);
   btn_foto6.swapDepths(6);
   conte_foto5.swapDepths(5);
   var trans:Transform= new Transform(btn_foto6.conte_foto5);
   var gris:ColorTransform= new ColorTransform(1,1,1,1,-30,-30,-30,-120);
   trans.colorTransform=gris;
}
//-------------------------------------------
//-------------------------------------------

btn_foto9.onRollOver=function(){
   var camara:Sound= new Sound();
   camara.attachSound("Camera");
   camara.setVolume(100);
   camara.start();
   
   btn_foto9.conte_foto8.luz("in",1);
   marco_foto7.swapDepths(22);
   btn_foto9.swapDepths(24);
   conte_foto8.swapDepths(23);
}

btn_foto9.onRollOut=function(){
      stopAllSounds();
marco_foto7.swapDepths(7);
   btn_foto9.swapDepths(9);
   conte_foto8.swapDepths(8);
   var trans:Transform= new Transform(btn_foto9.conte_foto8);
   var gris:ColorTransform= new ColorTransform(1,1,1,1,-30,-30,-30,-120);
   trans.colorTransform=gris;
}
//-----------------------------------------------
//-----------------------------------------------

btn_foto12.onRollOver=function(){
   var camara:Sound= new Sound();
   camara.attachSound("Camera");
   camara.setVolume(100);
   camara.start();
   
   btn_foto12.conte_foto11.luz("in",1);
   marco_foto10.swapDepths(22);
   btn_foto12.swapDepths(24);
   conte_foto11.swapDepths(23);
}

btn_foto12.onRollOut=function(){
      stopAllSounds();
marco_foto10.swapDepths(10);
   btn_foto12.swapDepths(12);
   conte_foto11.swapDepths(11);
   var trans:Transform= new Transform(btn_foto12.conte_foto11);
   var gris:ColorTransform= new ColorTransform(1,1,1,1,-30,-30,-30,-120);
   trans.colorTransform=gris;
}
//-----------------------------------------
//-----------------------------------------
btn_foto15.onRollOver=function(){
   var camara:Sound= new Sound();
   camara.attachSound("Camera");
   camara.setVolume(100);
   camara.start();
   
   btn_foto15.conte_foto14.luz("in",1);
   marco_foto13.swapDepths(22);
   btn_foto15.swapDepths(24);
   conte_foto14.swapDepths(23);
}

btn_foto15.onRollOut=function(){
      stopAllSounds();
marco_foto13.swapDepths(13);
   btn_foto15.swapDepths(15);
   conte_foto14.swapDepths(14);
   var trans:Transform= new Transform(btn_foto15.conte_foto14);
   var gris:ColorTransform= new ColorTransform(1,1,1,1,-30,-30,-30,-120);
   trans.colorTransform=gris;
}
//-----------------------------------
//-----------------------------------
btn_foto18.onRollOver=function(){
   var camara:Sound= new Sound();
   camara.attachSound("Camera");
   camara.setVolume(100);
   camara.start();
   
   btn_foto18.conte_foto17.luz("in",1);
   marco_foto16.swapDepths(22);
   btn_foto18.swapDepths(24);
   conte_foto17.swapDepths(23);
}

btn_foto18.onRollOut=function(){
   stopAllSounds();   
marco_foto16.swapDepths(16);
   btn_foto18.swapDepths(18);
   conte_foto17.swapDepths(17);
   var trans:Transform= new Transform(btn_foto18.conte_foto17);
   var gris:ColorTransform= new ColorTransform(1,1,1,1,-30,-30,-30,-120);
   trans.colorTransform=gris;
}
//------------------------------------
//------------------------------------
btn_foto21.onRollOver=function(){
   var camara:Sound= new Sound();
   camara.attachSound("Camera");
   camara.setVolume(100);
   camara.start();
   
   btn_foto21.conte_foto20.luz("in",1);
   marco_foto19.swapDepths(22);
   btn_foto21.swapDepths(24);
   conte_foto20.swapDepths(23);
}

btn_foto21.onRollOut=function(){
   
   stopAllSounds();
marco_foto19.swapDepths(19);
   btn_foto21.swapDepths(21);
   conte_foto20.swapDepths(20);
   var trans:Transform= new Transform(btn_foto21.conte_foto20);
   var gris:ColorTransform= new ColorTransform(1,1,1,1,-30,-30,-30,-120);
   trans.colorTransform=gris;
}


Como vez es mucho codigo y es lo mismo y se que puedo simplificar pero no me salio po esta seccion:

btn_foto21.conte_foto20.luz("in",1);

Por sfa

72 de clabLevel



 

Mexico DF

firefox
Citar            
MensajeEscrito el 26 Nov 2007 05:32 pm

Por sfa

72 de clabLevel



 

Mexico DF

firefox
Citar            
MensajeEscrito el 26 Nov 2007 06:47 pm
mira hice algo y puede que te funcione pero tendrías que editar algunas cosas para que se acomode del todo

Código :

var cantidad:Number = 9;
var ruta:MovieClip = this;
var camara:Sound= new Sound();
camara.attachSound("Camera");

//------------------------------------
for (i=1;i<=cantidad;i++) {
   var clip:MovieClip = eval("btn_foto"+i);
   clip.num = i;
   clip.onRollOver = function() {
      camara.start(0,0);
      this.swapDepths(24);
      this["conte_foto"+this.num-1].luz("in",1)
      ruta["marco_foto"+this.num-2].swapDepths(22);
      ruta["conte_foto"+this.num-1].swapDepths(22);
   }
   clip.onRollOut = function() {
      stopAllSounds();
      this.swapDepths(this.num);
      ruta["marco_foto"+this.num-2].swapDepths(this.num-2);
      ruta["conte_foto"+this.num-1].swapDepths(this.num-1);
      var trans:Transform= new Transform(this["conte_foto"+this.num-1]);
      var gris:ColorTransform= new ColorTransform(1,1,1,1,-30,-30,-30,-120);
        trans.colorTransform=gris;
   }
}

Por vcomics

217 de clabLevel



 

Medellin - Colombia

firefox
Citar            
MensajeEscrito el 28 Nov 2007 01:39 pm
Así es como se resolvio finalmente:

Código :

//*-----------------------------------------------------------------------------
arrPos = [0,[208,135,0],[305,342,0],[340,177,0],[270,300,45],[54,330,0],[10,135,-10],[180,20,0]];
listener = new Object();
//------------------------------------------------------
listener.onLoadProgress= function(target_mc, loadedBytes, totalBytes){
    var porcentaje:Number = Math.round((loadedBytes*100)/totalBytes);
    target_mc._parent.Contador.gotoAndStop(porcentaje);
};
//------------------------------------------------------
listener.onLoadComplete = function(target_mc, Estado){
    target_mc._parent.Contador.removeMovieClip();
}; 
//------------------------------------------------------
for(i=1;i<=7;i++){
   objFoto = _root.createEmptyMovieClip("Foto"+i,i);
   objFoto.Prof = i;
   objMarco = objFoto.createEmptyMovieClip("Marco",10+i);
   objConte = objFoto.createEmptyMovieClip("Conte",30+i);
   objFoto.attachMovie("Contador","Contador",50+i);
   objFoto.Contador._x = 45;
   objFoto.Contador._y = 85;
   objConte._x = objConte._y = 5;
   with(objMarco){
      beginFill(0xffffff);
      lineStyle(1,0x999999,100);
      moveTo(0,0);
      lineTo(0,209);
      lineTo(179,209);
      lineTo(179,0);
      lineTo(0,0);
      endFill();
   }
   objFoto._x = arrPos[i][0];
   objFoto._y = arrPos[i][1];
   objFoto._rotation = arrPos[i][2];
   objFoto.onRollOver=function(){
      _root.SonidoFoto.play();
      this.Conte.luz("in",1);
      this.swapDepths(1000);
   }
   //-------------------------------
   objFoto.onRollOut=function(){
      stopAllSounds();
      this.swapDepths(this.Prof);
      var trans:Transform = new Transform(this.Conte);
      trans.colorTransform=gris;
   }
   //------------------------------------------------------
   //------------------------------------------------------
   objFoto.Cargador = new MovieClipLoader();
   objFoto.Cargador.addListener(listener);
   objFoto.Cargador.loadClip("collage/foto" + i + ".jpg", objConte);
}

Por gabynufe

Claber

446 de clabLevel



 

México, D.F.

msie7

 

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