Copy link to clipboard
Copied
I have this code al set up, but I would like for the input fields and check boxes to clear after submition. How do I do that?
Thank you
import flash.net.URLVariables;
import flash.net.URLRequest;
submit.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
function fl_MouseClickHandler(event:MouseEvent):void
{
if (eMail.text == ""){
eMail.text = "Please enter in your email address";
}
else{
// Start your custom code
// create a variable container
var allVars:URLVariables = new URLVariables();
allVars.eMail = eMail.text;
allVars.bead = bead.selected;
allVars.jewelry = jewelry.selected;
allVars.onlineNewsletter = onlineNewsletter.selected;
allVars.sandiegoNewsletter = sandiegoNewsletter.selected;
//send info to URL
var mailAddress:URLRequest = new URLRequest("http://www.southsunbeads.com/form.php");
mailAddress.data = allVars;
mailAddress.method = URLRequestMethod.POST;
sendToURL(mailAddress);
thankyou.text = "Thank you!";
}
}
(Sometimes the timing between us is unbelieveable.... I let this one sit figuring Andrei might have hit it while here earlier, but finding it still unanswered I was just about to post, but checked first just before hitting the Post button...)
Copy link to clipboard
Copied
assign your checkboxes selected property to false and your textfield's text property to "".
Copy link to clipboard
Copied
(Sometimes the timing between us is unbelieveable.... I let this one sit figuring Andrei might have hit it while here earlier, but finding it still unanswered I was just about to post, but checked first just before hitting the Post button...)
Copy link to clipboard
Copied
lol. it's always risky to start answering and then fail to post immediately.
Copy link to clipboard
Copied
Thank you that worked? but I think I'm still doing something wrong because it clear the fields but also the results, so when I get the results back, it shows as marked false when was actually marked true.
Also I'm just getting the results from the boxes but nothign for the email address. Could you please point me in the right direcction with this? Thank you so much...
import flash.net.URLVariables;
import flash.net.URLRequest;
/* Mouse Click Event
Clicking on the specified symbol instance executes a function in which you can add your own custom code.
Instructions:
1. Add your custom code on a new line after the line that says "// Start your custom code" below.
The code will execute when the symbol instance is clicked.
*/
submit.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
function fl_MouseClickHandler(event:MouseEvent):void
{
if (eMail.text == ""){
eMail.text = "Please enter in your email address";
}
else{
// Start your custom code
eMail.text = "";
bead.selected = false;
jewelry.selected = false;
onlineNewsletter.selected = false;
sandiegoNewsletter.selected = false;
// create a variable container
var allVars:URLVariables = new URLVariables();
allVars.eMail = eMail.text;
allVars.bead = bead.selected;
allVars.jewelry = jewelry.selected;
allVars.onlineNewsletter = onlineNewsletter.selected;
allVars.sandiegoNewsletter = sandiegoNewsletter.selected;
//send info to URL
var mailAddress:URLRequest = new URLRequest("http://www.southsunbeads.net/form.php");
mailAddress.data = allVars;
mailAddress.method = URLRequestMethod.POST;
sendToURL(mailAddress);
thankyou.text = "Thank you!";
}
}
My php is ....
<?php
// Create local variables from the Flash ActionScript posted variables
$senderEmail = $_POST['eMail'];
$senderNewsletter1 = $_POST['bead'];
$senderNewsletter2 = $_POST['jewelry'];
$senderNewsletter3 = $_POST['onlineNewsletter'];
$senderNewsletter4 = $_POST['sandiegoNewsletter'];
// Strip slashes on the Local typed-in variables for security and run any php based error check here
$senderEmail = stripslashes($eMail);
$senderMessage = stripslashes($senderMessage);
// IMPORTANT - Change these lines to be appropriate for your needs - IMPORTANT !!!!!!!!!!!!!!!!!!
$to = "info@southsunbeads.com";
$from = "info@southsunbeads.com";
$subject = "Response from game2";
// Modify the Body of the message however you like
$message = "Results from the form:
e-mail: $senderEmail
Bead deal of the day: $senderNewsletter1
Jewelry deal of the day: $senderNewsletter2
online Newsletter: $senderNewsletter3
San Diego Newsletter: $senderNewsletter4
$senderMessage";
// Build $headers Variable
$headers = "From: $from\r\n";
$headers .= "Content-type: text\r\n";
$to = "$to";
// Send the email
mail($to, $subject, $message, $headers);
// Assemble the message that goes back to Flash
// The flash ActionScript is looking for a return variable of "return_msg" there is no sendername in my form, can be just change to generic message
$my_msg = "Thanks $senderName, all data has been sent.";
// Print the data back to flash who is patiently waiting for it in the onCompleteHandler
print "return_msg=$my_msg";
// Exit script
exit();
?>
Copy link to clipboard
Copied
I may as well earn some of it.... Don't reset the values until after you process them...
function fl_MouseClickHandler(event:MouseEvent):void
{
if (eMail.text == ""){
eMail.text = "Please enter in your email address";
}
else{
// Start your custom code
// create a variable container
var allVars:URLVariables = new URLVariables();
allVars.eMail = eMail.text;
allVars.bead = bead.selected;
allVars.jewelry = jewelry.selected;
allVars.onlineNewsletter = onlineNewsletter.selected;
allVars.sandiegoNewsletter = sandiegoNewsletter.selected;
//send info to URL
var mailAddress:URLRequest = new URLRequest("http://www.southsunbeads.net/form.php");
mailAddress.data = allVars;
mailAddress.method = URLRequestMethod.POST;
sendToURL(mailAddress);
thankyou.text = "Thank you!";
}
eMail.text = "";
bead.selected = false;
jewelry.selected = false;
onlineNewsletter.selected = false;
sandiegoNewsletter.selected = false;
}
Copy link to clipboard
Copied
It works!!!!
Thanks a lot!!![]()
Copy link to clipboard
Copied
You're welcome
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more