PDA

View Full Version : Error #2101: The String passed to URLVariables.decode() must be a URL-encoded


American horizon
12-21-2011, 10:01 PM
I've created some script in php e recalled it into AS3. I need to read his results into AS3 but every time that i execute the swf i retrieve this error
Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs
the code in PHP is very simple:

<?php
echo "var1=Fabio&var2=Pippo";
?>



This is the code in actionscript:

var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, completeHandler);

var request:URLRequest = new URLRequest("http://americanhorizon.altervista.org/prova.php");
try {
loader.load(request);
} catch (error:Error) {
trace("Unable to load requested document.");
}


function completeHandler(event:Event):void {
var loader:URLLoader = URLLoader(event.target);
loader.dataFormat = URLLoaderDataFormat.TEXT;
trace("Content: " + loader.data);

var vars:URLVariables = new URLVariables(loader.data);
trace("Variable 1 " + vars.var1);
trace("Variable 2 " + vars.var2);
}