To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 08-20-2007, 04:22 PM   #1
dj_zyx
Junior Member
 
Join Date: Jul 2004
Posts: 27
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
__________________
www.djzyx.com
www.cman333.com
www.svsecurity.com
www.cipn.net
WEBMASTER
dj_zyx is offline   Reply With Quote
Old 08-20-2007, 04:27 PM   #2
dj_zyx
Junior Member
 
Join Date: Jul 2004
Posts: 27
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 name@domain.domaintype";
		return false;
	}
	
	return true;
};
/*
trace("actionscript@bokelberg.de".isEmail());
trace("test.test@test.com".isEmail());
trace("test.test@test.co.uk".isEmail());
trace("test.test@test.co.ukuk".isEmail());
trace("test.test@.uk".isEmail());
trace("test.test@test.co@uk".isEmail());
trace("te}st.test@test.co@uk".isEmail());
trace("www.moma.museum".isEmail());
trace("postmaster@moma.museum".isEmail());
trace("someone@de".isEmail());
trace("someone@.".isEmail());
trace("someone@de.".isEmail());
trace("someone@.de".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 = "sebastian@alawellness.com";
		$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.
__________________
www.djzyx.com
www.cman333.com
www.svsecurity.com
www.cipn.net
WEBMASTER
dj_zyx is offline   Reply With Quote
Old 08-25-2007, 07:27 PM   #3
dj_zyx
Junior Member
 
Join Date: Jul 2004
Posts: 27
anyone??????????????
__________________
www.djzyx.com
www.cman333.com
www.svsecurity.com
www.cipn.net
WEBMASTER
dj_zyx is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:24 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.