Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

mailTo method

This is a discussion on mailTo method within the Tutorials forums, part of the Flash English category; Do you remember the old method mailto of Actionscript 2.0 used together with getURL that allowed to open the ...


Go Back   Forum Flash CS3 Flash CS4 > Flash CS3 Flash CS4 > Flash English > Tutorials

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  4 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 05-03-08, 07:28
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,535
Rep Power: 6
Flep is on a distinguished road
mailTo method

Do you remember the old method mailto of Actionscript 2.0 used together with getURL that allowed to open the mail client of the user"

Do you think that with Actionscript 3.0, it is not possible anymore"

Wrong!

Even with the third version of Actionscript it is possible to use this command. It simply needs to be associated to the new method navigateToURL .


In this tutorial, I will show how to use 2 different methods, a simple one and a more complex one.


Example 1

I create a FLA and I save it as "main.fla".
Into which, I create a button that I instantiate on stage and I assign to it the instance name "myButton".

I open the action panel and I write:
Code:
function openMailClient(event:MouseEvent):void
{
   var request:URLRequest=new URLRequest();
   request.url="mailto:info[noSpam]flepstudio.org";
   navigateToURL(request,"self");
}
myButton.addEventListener(MouseEvent.CLICK,openMailClient);
And this the result:







Let us analyse the code

In the function openMailClient, I declare a new variable of type URLRequest and I assign to it as URL a string that contains the command mailto: followed of the eMail address to which the Mail Client (for example Outlook Express) will send the message.
Next, I use the method navigateToURL and I pass to it, as parameters, the variable URLRequest (named "request") and "_self".
I add a listener to the event MouseEvent.CLICK to "myButton" that will call the function openMailClient on click of the mouse on the button.

Example 2
With this example, other then passing the value for the eMail address to the user"s Mail Client, we will also pass the subject and body of the message.

I create a FLA and I save it as "main2.fla".
Into which, I create a button. I instantiate it on stage and I assign the instance name "myButton".
I create 3 text fields: 2 dynamic ones named "to_txt" and "subject_txt" and the third one, an input text field named "body_txt".
I open the panel action and I write:
Code:
to_txt.text='info@flepstudio.org';
subject_txt.text='eMail from website';
function openMailClient(event:MouseEvent):void
{
   var request:URLRequest=new URLRequest();
   request.url="mailto:"+to_txt.text+""subject="+subject_txt.text+"&body="+body_txt.text;
   navigateToURL(request,"_self");
}
myButton.addEventListener(MouseEvent.CLICK,openMailClient);
And this is the result:







The code used is based on the first example.
The difference is that we add parameters to the url of the variable "request" which is also of type URLRequest.

Stay tuned !
__________________

 


I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !

Last edited by Flep; 28-08-08 at 06:22..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 05-03-08, 21:05
Junior Member
 
Join Date: Dec 2007
Posts: 4
Rep Power: 0
paplone is on a distinguished road
Re: mailTo method

Cool simple demonstration of sending email. Will you be doing a tutorial where sending email doesn't involve triggering the recipient's client email?

paplone
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 13-03-08, 04:26
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,535
Rep Power: 6
Flep is on a distinguished road
Re: mailTo method

Quote:
Originally Posted by paplone View Post
Cool simple demonstration of sending email. Will you be doing a tutorial where sending email doesn't involve triggering the recipient's client email?

paplone
Hi

At the moment you can download the email form:
http://www.flepstudio.org/forum/down...?do=file&id=45
__________________

 


I recommend: Essential Actionscript 3.0

- I do not reply technicians pvt messages. Open a thread !
- Non rispondo ai messaggi privati con domande tecniche. Apri una discussione sul forum !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-04-08, 17:11
Junior Member
 
Join Date: Mar 2008
Posts: 3
Rep Power: 0
moo74 is on a distinguished road
Re: mailTo method

I have a problem when using this code. for some reason a webpage and an email client opens up is there an extra code I need to insert. Here is my code

stop();

email1_btn.addEventListener(MouseEvent.CLICK,email 1);
function email1(event:MouseEvent):void
{
var request:URLRequest=new URLRequest();
request.url="mailto:first.last@cbre.com";
navigateToURL(request,"self");
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-04-08, 18:42
Junior Member
 
Join Date: Mar 2008
Posts: 3
Rep Power: 0
moo74 is on a distinguished road
Re: mailTo method

I figured out that the culprit is Windows Explorer because it doesn't happen in Firefox. Is there a script I can put in the html to say no pop-up? Or is there another way around this?

Thanks!
moo74
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 18-08-08, 15:51
Junior Member
 
Join Date: Aug 2008
Posts: 3
Rep Power: 0
cangrejero is on a distinguished road
Re: mailTo method

Flep ... I'm trying to access but I'm not allowed. Could you assist? Any help appreciated. Thanks!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 19-08-08, 20:00
Junior Member
 
Join Date: Aug 2008
Posts: 3
Rep Power: 0
cangrejero is on a distinguished road
mailTo method

I'm flabbergasted! I can't make this work (either method) when I code it in Flash. My site is in CS3. Could that be the reason? Any help appreciated. Thanks!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 19-08-08, 20:37
Onsitus's Avatar
CSS.FlepStudio.org
 
Join Date: Jul 2007
Location: Nettuno Beach
Posts: 1,062
Rep Power: 3
Onsitus is on a distinguished road
Re: mailTo method

Quote:
Originally Posted by cangrejero View Post
I'm flabbergasted! I can't make this work (either method) when I code it in Flash. My site is in CS3. Could that be the reason? Any help appreciated. Thanks!!
You are using flash cs3, ok...but are you using actionscript 3.0?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 20-08-08, 01:38
Junior Member
 
Join Date: Aug 2008
Posts: 3
Rep Power: 0
cangrejero is on a distinguished road
Re: mailTo method

Onsitus ... I know I am using CS3 because that's what the splash screen says. I have no idea what version of AS was used on the original template. Honestly ... other than being able to turn on my PC with either hand, I can't do much more. Any guidance is appreciated. I am willing to learn. Take care and thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
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 On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Actionscript 3 mailto in action script 3 derek_z Flash Italiano 2 02-10-08 12:10
Actionscript 3 Funzione mailto matteo78 Actionscript 3.0 base 4 10-08-08 07:57
Metodo mailto di Flash CS3 Flep Articoli e tutorials 3 06-03-08 11:15
getBounds method Flep Tutorials 0 20-12-07 06:38
curveTo Method with Actionscript 3.0 Flep Tutorials 0 29-09-07 10:18


All times are GMT. The time now is 19:20.

Powered by vBulletin version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap