2 Replies Latest reply on Oct 3, 2007 1:08 AM by Flyer2005

    AS3 & PHP

    Flyer2005
      I am trying to retrieve name and value pairs from a php script with AS3. Flash keeps giving me the error.

      Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.

      Here is an extract of my php.

      while ($row = mysql_fetch_assoc ($qr)) {
      while (list ($key, $val) = each ($row)) {
      $r_string .= '&' . $key . $i . '=' .$val;
      }
      $i++;
      }
      // add extra & to prevent returning extra chars at the end
      $r_string .='&';

      echo $r_string;

      If i change the echo to something like echo "name&value" it works, its as if it does not like the $r_string. I have tried using urlencode($r_string) and string($r_string) but it fails. The php used to work in AS2 with sendAndLoad fine.
        • 1. Re: AS3 & PHP
          scrfix Level 1
          Use the php URLEncode function when sending to flash. That should clear up the issue. AS3 requires everything to be URL Encoded.

          Look up URLEncode on php.net for examples.

          Wayne
          • 2. Re: AS3 & PHP
            Flyer2005 Level 1
            Thanks for your reply, however php does not seem to have a URLEncode function, it has a urlencode function which I tried, I pointed that out at the bottom of my original post.

            Like I said previously, if i echo "name&value" (which is not urlencoded) it works fine.