4 Replies Latest reply on Aug 8, 2006 8:41 PM by deej07

    help needed on loadVars

    deej07
      hi all, I need help on this one,

      here's the thing I want to create a flash application where a random data is called from a text file. My problem is how to get flash to call a random data from the text file. Here's what I got so far:

      _global.qno = "q"+Math.round(Math.random(5));

      loadVarsText = new LoadVars();
      loadVarsText.load("quote.txt");

      loadVarsText.onLoad = function(success) {
      if (success) {
      dyntxt = _global.qno;
      } else {
      trace("not loaded");
      }
      };


      here's the content of my textfile:
      &q0=data1&q1=data2

      Now when I run the application all I get is the variable name posted on my dynamic textbox.
      If anyone could help me, i would really be greatful.
      Thanks in advance.
        • 1. Re: help needed on loadVars
          kglad Adobe Community Professional & MVP
          there is more than 1 problem with your coding. but what is that you're trying to accomplish?
          • 2. Re: help needed on loadVars
            deej07 Level 1
            ok here it is again, I want to create a flash that displays a random data on a dynamic text box, this data are all coming from a text file. Now I already have a flash application named "datablog.swf" and I want this application to display a random data from a text file named "quote.txt". On the first frame I placed a dynamic text box with a variable name "dyntxt". And also on the first frame is this code:

            _global.qno = "q"+Math.round(Math.random(5));

            loadVarsText = new LoadVars();
            loadVarsText.load("quote.txt");

            loadVarsText.onLoad = function(success) {
            if (success) {
            dyntxt = _global.qno;
            } else {
            trace("not loaded");
            }
            };



            Here's the content of the textfile(quote.txt):
            &q0=data1&q1=data2


            You'll notice that I included numbers on the var name of each data(q0, q1, etc..), it's because it's what I plan to call on random.So that flash will rely on this numbers to get it's data from the text file. But my problem is the code doesn't work, it only displays the var name on the textbox (q0,q1,q2, etc..). Can you find anything wrong with my codes.

            Thanks for a quick reply kglad.
            • 3. Re: help needed on loadVars
              Mac_Apollo
              This should work....


              • 4. Re: help needed on loadVars
                deej07 Level 1
                you're a freakin god Apollo!!

                thank you thank you! wow! really thanks!