Reputation: 511
How do I write AS to display exactly info that was typed on all textfields even displaying '@' on the url parameter.
I tested the form and the output looks like this -
email=cluneborg%40hotmail%2Ecom&lname=Luneborg&zip=75052&fname=Chistian
It should look like this - [email protected]&lname=Luneborg&zip=75052&fname=Chistian
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.navigateToURL;
mcButton.addEventListener(MouseEvent.MOUSE_UP, onClick);
function onClick(e:MouseEvent):void {
var scriptRequest:URLRequest = new URLRequest("../index.aspx");
var scriptLoader:URLLoader = new URLLoader();
var scriptVars:URLVariables = new URLVariables();
scriptLoader.addEventListener(Event.COMPLETE, handleLoadSuccessful);
scriptLoader.addEventListener(IOErrorEvent.IO_ERROR, handleLoadError);
scriptVars.fname = fname_txt.text;
scriptVars.lname = lname_txt.text;
scriptVars.email = email_txt.text;
scriptVars.zip = zip_txt.text;
scriptRequest.method = URLRequestMethod.POST;
scriptRequest.data = scriptVars;
scriptLoader.load(scriptRequest);
function handleLoadSuccessful($evt:Event):void
{
trace("Message sent.");
}
function handleLoadError($evt:IOErrorEvent):void
{
trace(scriptVars);
}
fname_txt.text = "";
lname_txt.text = "";
email_txt.text = "";
zip_txt.text = "";
}
mcButton.addEventListener(MouseEvent.ROLL_OVER, overFunction);
mcButton.addEventListener(MouseEvent.ROLL_OUT, outFunction);
function overFunction(evt:MouseEvent):void {
//trace ('its working');
mcView.gotoAndStop(2);
}
function outFunction(evt:MouseEvent):void {
//trace ('its working');
mcView.gotoAndStop(1);
}
fname_txt.addEventListener(FocusEvent.FOCUS_IN, clearBox1);
function clearBox1(FocusEvent)
{
fname_txt.text="";
}
lname_txt.addEventListener(FocusEvent.FOCUS_IN, clearBox2);
function clearBox2(FocusEvent)
{
lname_txt.text="";
}
email_txt.addEventListener(FocusEvent.FOCUS_IN, clearBox3);
function clearBox3(FocusEvent)
{
email_txt.text="";
}
zip_txt.addEventListener(FocusEvent.FOCUS_IN, clearBox4);
function clearBox4(FocusEvent)
{
zip_txt.text="";
}
Dont worry about the ASP - that hasnt been built yet. I wanted to test the output first.
Upvotes: 0
Views: 64
Reputation: 9839
Try this :
var str:String = 'email=your_email%40hotmail%2Ecom&lname=your_name&zip=111111&fname=your_fist_name'
trace(unescape(str))
// gives : [email protected]&lname=your_name&zip=111111&fname=your_fist_name
Upvotes: 1