title: AS2: load class variables with sendandload
body: <p>I'm using Actionscript 2.0 in combination with PHP, now I can make a call to my PHP file and receive data but apparently I have to use that data immediately, I cannot use it to fill my class variables.</p>
  
  <p>This is what I want : </p>
  
  <pre><code>class user {
  
  var lastname:String;
  
  function user(in_ID:Number){
          var ontvang:LoadVars = new LoadVars();
          var zend:LoadVars = new LoadVars();
          zend.ID = in_ID;
          zend.sendAndLoad("http://localhost/Services/getUser.php", ontvang, "POST");
          ontvang.onLoad = function(success:Boolean) {
              if (success) {
                  lastname = ontvang.lastname;
              } else {
                  lastname = 'error';
              }
          };
  }
  }
  </code></pre>
  
  <p>I've found out that this is a big issue in AS2, I found this post to work around it if you're loading XML data but I can't seem to get it to work with LoadVars :
  <a href="http://www.actionscript.org/forums/showthread.php3?t=144046" rel="nofollow noreferrer">http://www.actionscript.org/forums/showthread.php3?t=144046</a></p>
  
  <p>Any help would be appreciated ..</p>