Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How do I create an email link in Flash using action script 3?

Guest
Jul 02, 2011 Jul 02, 2011

I am a Web Design student and I just finished a class on Adobe Flash. I have created a simple web page for a friend using Flash 5.0 with ActionScript 3.0.

I have an emaill address on my page but I do not know how to write the script to create the link. This is not a subject we covered in class, nor could I find the info I needed in out book or on-line.

Can someone please help me? I need specifics!

Thank you.

Su-Jobi Web Design (Name of my future business!!)

TOPICS
ActionScript
6.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 02, 2011 Jul 02, 2011

if you can accept using the client default email program (if they have one), use:


navigateToURL(new URLRequest("mailto:info@whoever.com?subject=yoursubject&body=your message"));

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 02, 2011 Jul 02, 2011

OK. Do I type it exactly like it is written or do I substitute anything??

Sue

Susan Blair Cheatham

Su-Jobi Web Design

mailto:scheath2@eaglespace.northgatech.edu

Cell: 706 949-6035

Thank you for choosing Su-Jobi Web Design

We appreciate your trust!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 02, 2011 Jul 02, 2011

I want it to work on the click of a mouse: when I run or test the page the email comes up immediately. Here is what I have so far:

navigateToURL(new URLRequest("mailto:mailto:dale@swingswing-along.com?subject=yoursubject&body=your message"));

/* Mouse Click Event

Clicking on the specified symbol instance executes a function in which you can add your own custom code.

Instructions:

1. Add your custom code on a new line after the line that says "// Start your custom code" below.

The code will execute when the symbol instance is clicked.

*/

button_3.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_6);

function fl_MouseClickHandler_6(event:MouseEvent):void

{

// Start your custom code

// This example code displays the words "Mouse clicked" in the Output panel.

trace("Mouse clicked");

// End your custom code

}

So how do I get the email to open ONLY when the mouse clicks on the link??

Sue

Susan Blair Cheatham

Su-Jobi Web Design

mailto:scheath2@eaglespace.northgatech.edu

Cell: 706 949-6035

Thank you for choosing Su-Jobi Web Design

We appreciate your trust!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 02, 2011 Jul 02, 2011

Just replace the trace line in your button's event handler function (trace("Mouse clicked");) with the line that opens the email.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 02, 2011 Jul 02, 2011

use:

var subject:String="Email From Flash";  // <-replace this

var message:String="this is the message from flash;  // <- replace this

button_3.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_6);

function fl_MouseClickHandler_6(event:MouseEvent):void

{

navigateToURL(new URLRequest("mailto:mailto:dale@swingswing-along.com?subject="+subject+"&body="+message));

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 02, 2011 Jul 02, 2011

Thank you - but I still have not resolved my issue of the email link opening without a click from the mouse. As soon as my page starts to load the link opens and you don't get to see the cute animations I did for the web site...

But thank you for all your help.

Sue

Susan Blair Cheatham

Su-Jobi Web Design

mailto:scheath2@eaglespace.northgatech.edu

Cell: 706 949-6035

Thank you for choosing Su-Jobi Web Design

We appreciate your trust!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 02, 2011 Jul 02, 2011

then you're not using the code i suggested. or, you are but you're also using code that's causing the problem.

create a new fla, add your button_3 to the stage and copy and paste the suggested code and use no other code.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 03, 2011 Jul 03, 2011

It is working thank you.

Sue

Susan Blair Cheatham

Su-Jobi Web Design

mailto:scheath2@eaglespace.northgatech.edu

Cell: 706 949-6035

Thank you for choosing Su-Jobi Web Design

We appreciate your trust!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 03, 2011 Jul 03, 2011
LATEST

you're welcome.

p.s.  in the future, please mark correct/helpful responses, if there are any.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 02, 2011 Jul 02, 2011

If you still have this line by itself at the top, remove it, that is what is causing it to happen...

navigateToURL(new URLRequest("mailto:mailto:dale@swingswing-along.com?subject=yoursubject&body=your message"));

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 03, 2011 Jul 03, 2011

Thank you: it is now working ...

Sue

Susan Blair Cheatham

Su-Jobi Web Design

mailto:scheath2@eaglespace.northgatech.edu

Cell: 706 949-6035

Thank you for choosing Su-Jobi Web Design

We appreciate your trust!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines