5 Replies Latest reply on Mar 21, 2010 1:27 PM by Dubbel D

    AUTOTYPING speed problem

    Dubbel D

      I managed to get a working code that allows a text to be auto-typed on screen; but the problem is whenever my video repeats itself for a second time (and after) the text gets typed way faster than in the first run, therefore no longer matching the animation that goes with it.

       

      My Flash is similar to an animated comic, so it's necessary that characters jump up at the right word; but like I mentioned, when my Flash is done playing and restarts, the typing speeds up.

      Not only that, but in some cases the code ignores the custom sign (like "_") I chose that "types out" my sentences, and replaces it with the standard "█".

       

       

      Is there another code,

      did I leave something out,

      or is there just no way to fix this the way I want?

        • 1. Re: AUTOTYPING speed problem
          kglad Adobe Community Professional & MVP

          if you're using a listener to "type" your text, remove that listener before re-adding it.

           

          if you're using setInterval() to "type" your text, clear that interval before re-creating it.

           

          if you don't understand what you're doing, post your code that "types" your text.

          • 2. Re: AUTOTYPING speed problem
            Dubbel D Level 1

            I am using a "setInterval" code, but I do not understand what you mean by clearing it every time.

            This is the code that I am using:

             

            "var i:Number = 0;
            var myMessage:String = "...What are we going to do now";
            function autoWrite():Void {
                if (i<=myMessage.length) {
                    monitor_txt2.text = myMessage.substr(0, i)+"?";
                    i = i+1;
                } else {
                    clearInterval(writingInterval);
                }
            }
            var writingInterval:Number = setInterval(autoWrite, 80);"

             

            What is it that I have to do?

            • 3. Re: AUTOTYPING speed problem
              kglad Adobe Community Professional & MVP

              use:

               


               

              var i:Number = 0;
              var myMessage:String = "...What are we going to do now";
              function autoWrite():Void {
                  if (i<=myMessage.length) {
                      monitor_txt2.text = myMessage.substr(0, i)+"?";
                      i = i+1;
                  } else {
                      clearInterval(writingInterval);
                  }
              }

               

              clearInterval(writingInterval);

              var writingInterval:Number = setInterval(autoWrite, 80);

               

               

              • 4. Re: AUTOTYPING speed problem
                Dubbel D Level 1

                Nothing changed. It's the same with the previous code; the first play looks good but as soon the Flash restarts the typing increases speed.

                • 5. Re: AUTOTYPING speed problem
                  Dubbel D Level 1

                  Oh geez, never mind my brainless blatter.

                  It works just fine, I forgot to add it to the rest of the codes.