Converting HTML Forms to Actionscript

Hello,

I need to convert the below form - which is in HTML - to do the same thing in actionscript w/MX 2004. It is logging on to a firstclass server, so if you even have an example file of how this could work - that would be great.

Thanks


<FORM name=“LOGINFORM” action=“http://mail.myserver.com/Login” target=“blank” method=“post” enctype=“application/x-www-form-urlencoded” onsubmit=“return CMD5(this);”>
<TABLE align=“center” cellpadding=“0” cellspacing=“0” border=“0”>

    &lt;TD&gt;&nbsp;&lt;/TD&gt;
    &lt;TD&gt;&lt;TABLE cellpadding="2" cellspacing="0" border="0"&gt;
        &lt;TR&gt; 
          &lt;TD&gt;&lt;INPUT name="userid" type="text" tabIndex="1" size="10" maxlength="15"&gt;&lt;/TD&gt;
		  &lt;TD&gt;&lt;INPUT type="password" name="password" size="10" maxlength="12" value="" tabIndex="2" onFocus="this.select();" onChange="sp=null;"&gt;&lt;/TD&gt;

       &lt;/TR&gt;

You are goona have to make it do this yourself (we dont do work for you) using the components provided in flash and a little bit of actionscript. So make your form and give each component a unique instance name. Once you have that done make yourself a button. The actions for the button:


on(release) {
    loader = new LoadVars(); //create new loadVars object
    loader.variable = input_box.text; //set loadvars variable for sending VIA post method
    //do the above line for every object in your form replacing variable with the name of the object in the HTML form, and replacing input_box with the instance name of the object
    loader.send("page_that_form_was_going_to_be_submitted_to.ext", "POST");
}

That will do the same thing as the HTML form, however it will not display the page the info was sent to. If you would like to display a confirmation, or something like that, design the send to page so it returns a variable confirming the data, and use sendAndLoad instead of send. and add this underneath:


loader.onLoad = function(success) {
    if(success) {
        //confirmation actions
    } else {
        //error actions
    }
}

Thank you very much, that worked great. The only problem though is this portion of the form:

target=“blank” method=“post” enctype=“application/x-www-form-urlencoded”

Though the login now sends its variables, because it is trying to login to a firstclass server…it’s having trouble. I’m not familiar enough with HTML or Actionscript to send the encode type variable…

thanks.