-
Flash Mailer help!
I am kinda newbish when it comes to flash. However I'm trying to get a mailer box to work on one of my websites.
www.autozonecollision.com
If you look at the contact box I want to get that working.
Here is the website I have working right now
http://www.alawellness.com/contact.htm
I want to take that box and insert that into my flash file at autozonecollsion.com
if anyone could give me some tips on how to do that, I would appreciate it.
Thanks in Advance
-
this is the flash code.
Code:
String.prototype.isset = function ()
{
if ((this == undefined) || (this == null) || (this == ""))
{
return false;
}
else
{
return true;
}
}
// String.prototype.isEmail
// http://proto.layer51.com/d.aspx?f=78
// author: MikeChambers
// Submitted: 03.12.02 3p•09.20.02 12a
String.prototype.isEmail = function()
{
//email address has to have at least 5 chars
if (this.length < 5)
{
return false;
}
var iChars = "*|,\":<>[]{}`';()&$#%";
var eLength = this.length;
for (var i = 0; i < eLength; i++)
{
if (iChars.indexOf(this.charAt(i)) != -1)
{
trace("Invalid Email Address : Illegal Character in Email Address : -->" + this.charAt(i) + "<--.");
return false;
}
}
var atIndex = this.lastIndexOf("@");
if (atIndex < 1 || (atIndex == eLength - 1))
{
trace("Invalid Email Address : Email Address must contain @ as at least the second chararcter.");
return false;
}
var pIndex = this.lastIndexOf(".");
if (pIndex < 4 || (pIndex == eLength - 1))
{
trace("Invalid Email Address : Email Address must contain at least one . (period) in a valid position");
return false;
}
if (atIndex > pIndex)
{
this.__error = "Invalid Email Address : Email Address must be in the form of [email protected]";
return false;
}
return true;
};
/*
trace("[email protected]".isEmail());
trace("[email protected]".isEmail());
trace("[email protected]".isEmail());
trace("[email protected]".isEmail());
trace("[email protected]".isEmail());
trace("[email protected]@uk".isEmail());
trace("te}[email protected]@uk".isEmail());
trace("www.moma.museum".isEmail());
trace("[email protected]".isEmail());
trace("someone@de".isEmail());
trace("someone@.".isEmail());
trace("someone@de.".isEmail());
trace("[email protected]".isEmail());
*/
Code:
Stage.scaleMode = "noScale";
Stage.showMenu = false;
stop();
init();
function init() {
this.info_mc.stop();
this.info_mc._x = 610;
this.send_btn._focusrect = false;
this.name_txt.tabIndex = 1;
this.email_txt.tabIndex = 2;
this.message_txt.tabIndex = 3;
this.send_btn.tabIndex = 4;
this.name_txt.text = "";
this.email_txt.text = "";
this.message_txt.text = "";
setTextFocus(this.name_txt);
}
function setTextFocus(tf) {
Selection.setFocus(tf);
}
this.send_btn.onPress = function() {
validateForm();
};
function validateForm() {
if ((name_txt.text.isset()) && (name_txt.text != "Required Field")) {
if ((email_txt.text.isset()) && (email_txt.text.isEmail()) && (email_txt.text != "Required Field")) {
trace("email_txt.text.isEmail() = "+email_txt.text.isEmail());
if ((message_txt.text.isset()) && (message_txt.text != "Required Field")) {
info_mc.play();
info_mc._x = -18;
sendEmail();
} else {
message_txt.text = "Required Field";
setTextFocus(message_txt);
}
} else {
email_txt.text = "Required Field";
setTextFocus(email_txt);
}
} else {
name_txt.text = "Required Field";
setTextFocus(name_txt);
}
}
function sendEmail() {
email_lv = new LoadVars();
email_lv.name = this.name_txt.text;
email_lv.email = this.email_txt.text;
email_lv.message = this.message_txt.text;
email_lv.onLoad = function(ok) {
if (ok) {
trace("Email Sent!!!");
trace(unescape(this));
info_mc.gotoAndStop("Info"+this.result);
} else {
trace("Problem sending an Email!!!");
info_mc.gotoAndStop("Info2");
}
};
email_lv.sendAndLoad("mailer.php", email_lv, "POST");
}
first one is in Prototype : Frame 1
second one is in Action : Frame 1
There is a PHP file associated with this also.
Here's the code.
Code:
<?php
if ($_POST)
{
$mailTo = "[email protected]";
$mailSubject = "Ala Wellness Website Mailer - (" . $_POST['name'] . ")";
$Header = "MIME-Version: 1.0\r\n";
$Header .= "Content-type: text/html; charset=iso-8859-1\r\n";
$Header .= "From: " . $_POST['email'] . "\r\n";
$output = "<BR>";
$output .= "From : " . $_POST['name'] . "<BR><BR>";
$output .= "Email : " . $_POST['email'] . "<BR><BR>";
$output .= "Message : " . $_POST['message'] . "<BR><BR>";
$output = nl2br($output);
if (mail($mailTo, $mailSubject, stripslashes($output), $Header))
{
echo("&result=1&");
}
else
{
echo("&result=2&");
}
}
else
{
echo("This script runs only in Flash!!!");
}
?>
Im sure someone can just give me a few pointers on how to put the flash into www.autozonecollision.com in the contact section.
-