1 Reply Latest reply on May 10, 2006 4:11 PM by jthereliable

    LoadVars

    rochribre1 Level 1
      How I do to load a var with action script and to use, if this var to be a array in the php.
      teste[0] - is a Array the PHP and teste5.text is a Dynamic Text the flash
      this retorn = undefined and if I put only teste return = Array.

      var arquivo1:LoadVars = new LoadVars();
      arquivo1.load("info.php");
      arquivo1.onLoad = function(){
      teste5.text=arquivo1.teste[0];
      }

      Thanks.
        • 1. Re: LoadVars
          jthereliable
          ok... so, lemme get this straight... you want to load an array... right? I'm not totally sure if there's an easier way, but here's the way I'll use

          on PHP, do this:

          <?
          echo "&teste=";
          $teste=Array();
          $teste[]="hi";
          $teste[]="hi, again";
          for($i=0;$i<count($teste);$i++)
          {
          if($i!=0)
          {
          echo "||||";
          }
          echo $teste[$i];
          }
          echo "&";
          ?>

          and for inside the arquivo1.onLoad = function(), I'll do this:
          testearray=arquivo1.teste.split("||||");
          teste5.text=testearray[0]; //and if you want, you can do testearray[1]

          if you do that, teste5 will say "hi" and if you used 1, it'll say "hi, again"

          I'm not POSITIVE that it will work, because I didn't check and debug it for errors, but I hope you get the idea.
          (and I hope this was what you were looking for)