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

Reproducir indefinidamente typewriter.

Estas en el tema de Reproducir indefinidamente typewriter. en el foro de Flash y Actionscript en Foros del Web. Hola buenas Tengo un efecto de máquina de escribir (Typewriter) en un .fla de 1 sólo fotograma con estas acciones: @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código actionscript: Ver ...
  #1 (permalink)  
Antiguo 13/09/2011, 09:08
Avatar de Luckymusic  
Fecha de Ingreso: junio-2011
Ubicación: Camprodon (Pirineu Català)
Mensajes: 1
Antigüedad: 12 años, 10 meses
Puntos: 0
Reproducir indefinidamente typewriter.

Hola buenas

Tengo un efecto de máquina de escribir (Typewriter) en un .fla de 1 sólo fotograma con estas acciones:

Código actionscript:
Ver original
  1. //
  2. texto = "Lorem Ipsum pecatorem mea culpa Bla bla bla";
  3. //
  4. var myformat:TextFormat = new TextFormat();
  5. myformat.font = 'Lucida Console';
  6. myformat.size = 15;
  7. myformat.color = 0xFFFFFF;
  8. //
  9. velocidad = 20;
  10. margiz = 20;
  11. margder = 20;
  12. alto = Stage.height;
  13. margentotal = margiz+margder;
  14. _root.createTextField("mytext", 1, margiz, margder, Stage.width-margentotal, alto);
  15. mytext.multiline = true;
  16. mytext.wordWrap = true;
  17. mytext.setNewTextFormat(myformat);
  18. //
  19. var tpw:Typewriter = new Typewriter(mytext, texto, velocidad);

Y aparte el efecto propiamente dicho Typewriter.as guardado en la misma carpeta:

Código actionscript:
Ver original
  1. import mx.utils.Delegate;
  2. class Typewriter {
  3. private var interval:Number;
  4. private var string:String;
  5. private var speed:Number;
  6. private var textfield:TextField;
  7. private var index:Number;
  8. public function Typewriter (textfield:TextField, string:String, speed:Number) {
  9. this.textfield = textfield;
  10. this.string = string;
  11. this.speed = speed;
  12. index = 0;
  13. interval = setInterval(Delegate.create(this, exec), this.speed);
  14. }
  15. private function exec() {
  16. this.textfield.text = this.string.substr(0, index);
  17. index++;
  18. if (index > this.string.length) {
  19. clearInterval(interval);
  20. }
  21. }
  22. }

El caso es que cuando termina la animación se detiene, y me gustaría saber si hay modo de que se reproduzca en bucle indefinidamente. He probado varias cositas que he visto por ahí pero no hay manera.

Aclaro que NO publico como html, sólo quiero el swf.

Ah y uso Flash CS3 + ActionScript 2.

Gracias y hasta pronto.

Última edición por Luckymusic; 13/09/2011 a las 10:07 Razón: cambiar etiqueta as

Etiquetas: indefinidamente, reproducir, swf
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 16:32.