2 Replies Latest reply on Mar 27, 2008 8:05 PM by Helen3308

    How to randomly load external file content?

    Helen3308
      I want to randomly load the content from an external text file into a text area. Below is the content of textarea_content.txt:
      -----------------------------------------------------------
      mytext0=This message is from mytext 0
      &mytext1=this message is from mytext 1
      &mytext2 = this message is from mytext2
      -----------------------------------------------------------

      "mytextbox" is the name of textarea

      Could somebody take a look at the following code and tell me how to attach variable "myNum" to "this.mytext" to make it randomly load the message from mytext0 or mytext1 or mytext2?

      *********************************************
      var myNum:Number = random(2);

      loadtextContent = new LoadVars();
      loadtextContent.load("textarea_content.txt");
      loadtextContent.onLoad = function(success) {
      if (success) {
      mytextbox.text = this.mytext;
      }
      };


      ********************************************