AS#: Need Help With URLLoaderDataFormat

Hello,

I’m trying to get this to work, but when I trace the outgoing variables, characters are being replaced, such as underscores changing to %5F, and @ changing to %40. Here is my script:

//---------------Setup variables
var loader:URLLoader = new URLLoader();
var req:URLRequest = new URLRequest(“index.php”);
var variables:URLVariables = new URLVariables();
loader.dataFormat = URLLoaderDataFormat.TEXT;
req.method = URLRequestMethod.POST;

//--------------Set listener fot textfield changes
txEmail.addEventListener(Event.CHANGE, txErrorCheck);
function txErrorCheck(event:Event):void {
if (txError.text.length>0) {
txError.text = “”;
}
}

var varAction:String = “ext_addcontact”;
var varSelectedgroupname:String = “portal_launch_notification”;
var varGroupownerid:Number = 21;

//--------------Set up form buttons
butSend.addEventListener(MouseEvent.CLICK, sendForm);
butSend.txTitle.text=“SUBMIT”;

//--------------Validate fields and submit form
function sendForm(evt:MouseEvent):void {
if (!txEmail.text.length || txEmail.text.indexOf("@") == -1 || txEmail.text.indexOf(".") == -1) {
txError.text = “missing field/Invalid email”;
} else {
mcLoader.gotoAndPlay(2);
variables.email = txEmail.text;
variables.portal_notification_email = txEmail.text;
variables.action = varAction;
variables.selectedgroupname = varSelectedgroupname;
variables.groupownerid = varGroupownerid;
req.data = variables;
loader.load(req);
loader.addEventListener(Event.COMPLETE, messageSent);
trace(“sendForm called”);
}
}

function messageSent(evt:Event):void {
trace(txEmail.text);
trace("returned value = " + evt.target.data);
trace(variables);
if (evt.target.data==0) {
trace(“FAILED”)
} else if (evt.target.data==1) {
trace(“SUCCESS!!!”)
}
}

stop();

When I trace the outgoing variables, I get:

groupownerid=21&email=myname%40hotmial%2Ecom&action=ext%5Faddcontact&selectedgroupname=portal%5Flaunch%5Fnotification&portal%5Fnotification%5Femail=myname%40hotmial%2Ecom

Any help would be deeply appreciated!

r