Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Now we'll talk about some steps you have to take to set up your form to send an e-mail. If you're following along, I'm working in 03_Email_Setup.fla in the Chapter 07 folder in the Exercise Files folder. Lets select the first keyframe of the actions layer and open the Actions panel. Remember the keyboard shortcut is Option+F9 on the Mac, F9 on the PC. Now if we're going to be setting a form there are a few things that we need to set up, and the first thing is the address where our form is, or the address where the script that's going to process the form is.
So what I'm going to do is I'm going to create a variable called address. It's going to be a string, and I'm going to set this equal to value in quotes because it's a string, it's going to be "/cgi-bin/formmail.pl"; all lowercase. Now this code may not work on your Web server and let me tell you why. Every server is unique. This file may be located at a different place in your server.
This file may not even be installed on your server. This file is just a example of a sample file that would process a form e-mail. If there's somebody else that manages your Web server, you can get this address from them. If you manage your Web server and you don't know anything about this formmail.pl script or the cgi-bin folder, then you can look up in your Web host what you can do to install perl or CGI scripts. Follow that process and install a perl or CGI script if you don't know where to find one, just search for this filename: formmail.pl and you'll be able to find forms script with information on how to install that script on your server.
Again, this is unique for each server. So getting the place where your form is, is extremely important. Another thing that's important is creating a URL request. So I'm going to type var url and the datatype is going to be a URLRequest. We're going to give this variable a value later on. We're also going to need a function that's going to send the form. So let's go down a few lines and type submit_btn.addEventListener and the event's going to be MouseEvent.CLICK all caps, and we'll run a function called sendForm, with a capital F. Now let's define the sendForm function.
We'll do this right above where we added the event listener to the Submit button. So type function sendForm, with a capital F. This function will receive an event with a datatype of MouseEvent. And inside of this function we'll type url = new URLRequest and in the parentheses we'll pass in our address, so type in address Now on the next line, type in navigateTo, with a capital T, URL all caps, then in parentheses pass in url.
Navigate to URL leads to a webpage. So right now, this script is not going to work unless this Flash application were running on my Web server and I had a folder called cgi-bin and in there was a file called formmail.pl. So again you'll need to set up your server to run in a sort of way, and your address may be a little bit different, but this is the skeleton of what we're going to need to do to send a form. What we're going to do next is add something called form variables, or URL variables to our URL request to attach information when we run the navigateToURL function so that this form can be processed and sent in an e-mail.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.