Comunidad de diseño web y desarrollo en internet online

HELP con una estructura for

Citar            
MensajeEscrito el 23 Abr 2008 12:59 pm
buen dia a todos, necesito que me ayuden con este proyecto.
tengo 19 movies y 19 botones. y queria asignarle mediante un for las acciones del boton.
la accion que debe realizar es que el movieclip avance en su propia linea de tiempo.

aca esta el script que arme yo.

function encima() {
this["punto"+i].gotoAndPlay("over");

}
function afuera() {
this["punto"+i].gotoAndStop(10);
}
for (i=1; i<20; i++) {
this["b"+i].onRollOver = encima;
this["b"+i].onRollOut = afuera;
}


o esta pero tampoco funciona...


for (i=1; i<20; i++) {
this["b"+i].onRollOver = function() {
this["punto"+i].gotoAndPlay("over");
};
this["b"+i].onRollOut = function() {
this["punto"+i].gotoAndStop(10);
};

espero sepan ayudarme y gracias![/code]

Por da_vidricota

20 de clabLevel



 

firefox
Citar            
MensajeEscrito el 23 Abr 2008 02:30 pm
El i se pierde en el loop, los botones tienen que ser MC (de hecho no hace falta los botones), entonces haces esto:

Código :

for (i=1; i<20; i++) {
  this["b"+i].nr = i
 this["b"+i].onRollOver = function() {
    this["punto"+this.nr].gotoAndPlay("over");
};
 this["b"+i].onRollOut = function() {
   this["punto"+this.nr].gotoAndStop(10);
};


Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 23 Abr 2008 03:52 pm
muchisimas gracias man! ya lo corregi.
igualmente me tiraba un error en este punto.
this["punto"+this.nr].gotoAndPlay("over");
y lo reemplace por esta ruta:
_root.representantess["punto"+this.nr].gotoAndPlay("over");
y anda barbaro,
de vuelta gracias

Por da_vidricota

20 de clabLevel



 

firefox

 

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