4 Replies Latest reply on May 26, 2006 12:53 AM by timdiacon

    how to make this a function?!

    timdiacon
      I have a piece of code which makes the text in a text box appear character by character from a random string.

      header_text = "This is a test";
      header_length = header_text.length;
      count = 0;
      onEnterFrame = function () {
      random_text = "";
      for (i=0; i<header_length; i++) {
      random_text += chr(random(10)+33);
      }
      header.htmlText = random_text;
      //
      random_position = substring(random_text, count, header_length);
      text_position = substring(header_text, 0, count);
      new_text = text_position+random_position;
      header.htmlText = new_text;
      count += 1;
      };

      It works OK however I have been trying to turn it into a function so that I can make any text appear in any text box by calling something like...

      text_function(target_text_box,"string to appear");

      However I just cannot work out how to do it. Please help before I go mad!