Me respondo a mi mismo :)... El calor me está dejando frito, me tengo  
que mirar bien el uso de setInterval.

spinInterval = setInterval(this, "cambiarLetra", tiempo);

Perdonad.


El 05/08/2007, a las 19:16, Chemi escribió:

> Hola, estoy teniendo probemas con el siguiente código, a ver si
> alguien me puede echar una mano.
> El problema surge en la función cambiarLetra que, no se porque, no me
> coge las variables cuando la lanzo con setInterval.
> Cuando hago un trace de cualquiera de ellas me sale undefined excepto
> si lanzo la función sin el setInterval que me las coge perfectamente.
>
>
> class text.effects.Spin {
>       
>       // Variables
>       private var campo:TextField;
>       private var cadenaTexto:String;
>       private var caracteres:String;
>       private var numVueltas:Number;
>       private var tiempo:Number;
>       private var colorLetra:Number;
>       
>       private var spinInterval:Number;
>       
>       // Valores por defecto
>       private var defaultChar:String =
> "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ";
>       private var defaultNum:Number = 10;
>       private var defaultTemp:Number = 100;
>       private var defaultColor:Number = 0x000000;
>       
>       public function Spin (target:MovieClip, texto:String){          
>               campo = target.createTextField("campo", 1, 0, 0, 0, 0);
>               campo.autoSize = "left";
>               cadenaTexto = texto;
>       }
>       
>       public function startSpin(caracteres:String, numVueltas:Number,
> tiempo:Number, colorLetra:Number):Void {
>               if(caracteres == undefined){
>                       this.caracteres = defaultChar;
>               } else {
>                       this.caracteres = caracteres;
>               }
>               if(numVueltas == undefined || numVueltas == isNaN){
>                       this.numVueltas = defaultNum;
>               } else {
>                       this.numVueltas = numVueltas;
>               }
>               if(tiempo == undefined || tiempo == isNaN){
>                       this.tiempo = defaultTemp;
>               } else {
>                       this.tiempo = tiempo;
>               }
>               if(colorLetra == undefined || colorLetra == isNaN){
>                       this.colorLetra = defaultColor;
>               } else {
>                       this.colorLetra = colorLetra;
>               }
>               
>               temporizador();
>       }
>       
>       private function temporizador(){
>               spinInterval = setInterval(cambiarLetra, tiempo);
>       }
>       
>       private function cambiarLetra(){
>               trace(caracteres);
>       }
> }
> -----------------------------------------------------
> ASNativos
> www.5dms.com
> subscripciones/desubscripciones
> http://asnativos.5dms.com
> -----------------------------------------------------


-----------------------------------------------------
ASNativos
www.5dms.com
subscripciones/desubscripciones
http://asnativos.5dms.com
-----------------------------------------------------

Responder a