<A HREF="/Tech" TARGET="_self"><IMG SRC="FT-Logo.gif" WIDTH=137 HEIGHT=70 BORDER=0></A>
Actionscript - Email Form

Our email form uses the mailto: email link method to open a new email window and to fill in the subject, greeting and the email address complete with the name. It also will fill in text entered in the body and allows changes to the subject and the greeting. For more information on basic Email window opening see HTML - Emails.

There are two methods that can be used to send the mail parameters. One would be to let Flash send the variables with GET. With the GET method Flash would get all the current variables and their values and automatically add them to the URL in the correct format. Note, the variables in Flash must have the same name as the corresponding email parameter (subject, cc, body, etc.). This method requires that spaces be formatted to display properly. We are not using this method in this tutorial.

The method we are using, uses an expression in the getURL to compose the complete URL with all of the needed parameters. First we will create a string to represent the complete email address including the name which will be inserted into the mailto box.

Flash Bible <croteau@erols.com>
<A HREF="/Tech" TARGET="_self"><IMG SRC="FT-Logo.gif" WIDTH=137 HEIGHT=70 BORDER=0></A>
Download FLA in Zip format

Create the mailto variable
The three lines of code created in this section will be placed frame 1 as frame actions. We have created 2 variables - name and email - to make making changes easy.

Set Variable: "name" = "Flash Bible"
Set Variable: "email" = "croteau@erols.com"
These two string variables will then be combined with the literal strings "mailto", "<", and ">" to form the string variable mailto. The ampersand (&) is used to combine the strings.
Set Variable: "mailto" = "mailto:" & name & "<" & email & ">"

Create the button's getURL expression
In the Submit button we will add a getURL action and set the URL: box as an expression. We now combine the email address (mailto) with the parameters. Notice the body parameter is made up of three components: the greeting variable, newline and the body variable. Newline creates a new line so the body variable text starts on a new line below the greeting.

mailto & "?subject=" & subject & "&body=" & greeting  & newline & body
The getURL action box Window: should be left blank and the Variables option box should be left as as Don't send.