Groups | Blog | Home
all groups > flash actionscript > february 2005 >

flash actionscript : form basic



macca242424
2/5/2005 7:57:46 PM
hi i am using a flash form whats the quickest way to get it to send the info to an email address without using serverside,

can you give me the script i need for the btn etc

many thanks
kglad
2/6/2005 5:29:25 AM
on (release){
getURL ("mailto:" +recipient+ "?cc=" + cc + "&subject=" + subject + "&body=" +body)
}
macca242424
2/6/2005 9:07:58 PM
Hi i have tried this but i cant get it to work have i typed correctly code below


on (release){
getURL ("mailto:" macca2424@hotmail.com "?cc=" macca2424@tiscali.co.uk
"&subject=" Website Enquiry "&body=" +body)

}
kglad
2/6/2005 9:35:34 PM
whereever you have a string you need to enclose that string in quotes. where
you have a variable (like body) you need no quotes. try:

on (release) {

getURL("mailto:"+"macca2424@hotmail.com"+"?cc="+"macca2424@tiscali.co.uk"+"&sub
ject="+"Website Enquiry"+"&body="+body);
}

or

on (release) {

getURL("mailto:macca2424@hotmail.com?cc=macca2424@tiscali.co.uk&subject=Website
Enquiry&body="+body);
}

where body is a string defined in your flash before that release handler is
executed.
macca242424
2/6/2005 9:53:28 PM
ok i have tried both of these all i keep getting is another browser that opens with yahoo mail any ideas?

kglad
2/6/2005 10:11:33 PM
yes, that code must be attached to a button or movieclip. if you're not seeing
your default email client opening with the proper fields filled-out it is
because of an issue with your local system. that may not be a problem: you
probably don't have a default email client that is designated to load when an
email function is needed.
macca242424
2/6/2005 10:34:01 PM
ok i understand now so when a user presses the submit btn they then have to
send the enquiry using outlook?

on the body how do i seperate each item so they apear under eachother in the
email ie

name
address
etc
kglad
2/7/2005 4:12:34 AM
yes, using getURL employs the users email client. that can be a problem, as in
your case, where a user has no client. the more reliable alternative is to use
a server-side email program, but i know you wanted to avoid that.

sometimes you need to url encode symbols to communicate between flash and text
files. to encode a line feed use %0a in place of \r and \n:

body = body.split("\r").join("%0a").split("\n").join("%0a");

if body is the variable associated with an input text field you might want to
use a different variable name for this "new" variable or, at least, remove that
textfield from the stage so the user doesn't see his message get garbled.
macca242424
2/7/2005 8:22:55 AM
so how would i code it if i had name,address,address2,tel,email,enquiry?

would it be:
body =
body.split("name").join("address").split("address2").join("tel".split("email".jo
in("enquiry);

so they list underneath each other
kglad
2/7/2005 3:29:26 PM
enquiry = enquiry.split("\r").join("%0a").split("\n").join("%0a");
address=address.split("\r").join("%0a").split("\n").join("%0a");
address2=address2.split("\r").join("%0a").split("\n").join("%0a");

body=name+"%0a%0a"+address+"%0a%0a"+address2+"%0a%0a"+tel+"%0a%0a"+email+"%0a%0a
"+enquiry

this would put a line feed for each new line/paragraph in flash and put a
double line feed between name, address, address2 etc
kglad
2/7/2005 3:30:29 PM
AddThis Social Bookmark Button