0

How do I write AS to display exactly info that was typed on all textfields even displaying '@' on the url parameter.

enter image description here

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.

6
  • The output is correct, if you expect a @ to be displayed in a query then you should read about url and url query since you are lacking the basic knowledge of it. Commented Nov 3, 2014 at 20:47
  • What's the problem ? You can decode data using your server side script to get your @ ! Commented Nov 3, 2014 at 21:48
  • decode in javascript? Commented Nov 3, 2014 at 22:02
  • 1
    not javascript, I told you your server side script, ASP in your case. Commented Nov 3, 2014 at 22:06
  • Ok, thanks. I didnt expect that kind of answer, but I was hoping somebody would come up with an idea to write AS3 to display the @ symbol on the URL parameter. Commented Nov 3, 2014 at 22:21

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

3 Comments

What if its a different email address by other users? So it cant be just hotmail.
No, it's just an example, I didn't like to put your email address. You can use it as you like, unsescape didn't know what string it contains ;)
This is probably a good example what Im looking for - test.adform.com/testpage/banner-specifications/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.