Foros del Web » Creando para Internet » Flash y Actionscript »

Duda sobre alcances

Estas en el tema de Duda sobre alcances en el foro de Flash y Actionscript en Foros del Web. Código: function darSegundos():Number { var nSegundos:Number = Math.floor(getTimer() / 1000); return nSegundos; } function moverSegundero():Void { var nRotacion:Number = darSegundos(); // LA LINEA SIGUIENTE NO ...
  #1 (permalink)  
Antiguo 10/11/2006, 06:51
 
Fecha de Ingreso: septiembre-2006
Mensajes: 9
Antigüedad: 17 años, 7 meses
Puntos: 0
Duda sobre alcances

Código:
function darSegundos():Number {
   var nSegundos:Number = Math.floor(getTimer() / 1000);
   return nSegundos;
}
function moverSegundero():Void {
   var nRotacion:Number = darSegundos();
   // LA LINEA SIGUIENTE NO FUNCIONA CON this, PERO SI CON _root,
   // NO ENTIENDO POR QUE. 
   // TAMPOCO ENTIENDO POR QUE SI HAGO UN TRACE A THIS DENTRO
   // DE ESTA FUNCION ME DEVUELVE undefined
   // NO SE SUPONE QUE ESTE this DEBERIA HACER REFERENCIA A LA 
   // LINEA DE TIEMPO PRINCIPAL?
   //(el clip mcSegundero esta en _root) Ahi va la linea:
   this.mcSegundero._rotation += nRotacion;
}
setInterval(moverSegundero, 1000);
  #2 (permalink)  
Antiguo 15/11/2006, 14:30
 
Fecha de Ingreso: marzo-2004
Mensajes: 40
Antigüedad: 20 años, 1 mes
Puntos: 0
Esta un poco enredado, pero lo que te puedo decir es que this no hace referencia a la linea de tiempo principal, sino _root. this se usa para referirse a la linea de tiempo del clip donde lo uses.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:29.