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

Getting a button to link to mailto link

New Here ,
Mar 26, 2009 Mar 26, 2009
OK, I've trawled the web, everyone with different ideas on how to call up a mailto link in AS3.
What I'm looking for is this:
I have a box, that is coverted to a button symbol given the name 'mailto'
I have another layer for the actionscript
I have imported 'flash.net.navigateToURL' and 'flash.net.URLRequest'
I know I need to create a function or a variable to link in the already created button.
Do I also need to import the MouseEvents?

I created this FLA to get used to CS4 (i was previously using 8)
Everything works wonderfully, I would just like to know how to use AS3 properly, without having to call defeat and create the FLA again using AS2.
TOPICS
ActionScript
2.9K
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

correct answers 1 Correct answer

Explorer , Mar 26, 2009 Mar 26, 2009
//SET THE MAILTO ADDRESS
var emailLink:String = "mailto:xxxx@xxxxx.com";

//ADD EVENT LISTENER FOR EMAIL LINK
mailtoLink.addEventListener(MouseEvent.MOUSE_DOWN,function():void {
navigateToURL(new URLRequest(emailLink), "_self");}
);
Translate
Explorer ,
Mar 26, 2009 Mar 26, 2009
//SET THE MAILTO ADDRESS
var emailLink:String = "mailto:xxxx@xxxxx.com";

//ADD EVENT LISTENER FOR EMAIL LINK
mailtoLink.addEventListener(MouseEvent.MOUSE_DOWN,function():void {
navigateToURL(new URLRequest(emailLink), "_self");}
);
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
New Here ,
Mar 26, 2009 Mar 26, 2009
Thank you very much..
I'm almost there now.
I come up with an error saying that I have an unidentified property mailtoLink. I'm guessing this would be for the button itself. How would I tell the code that this link will happen when that button is clicked?
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 ,
Mar 26, 2009 Mar 26, 2009
mailtoLink would be the instance name of the button, so either name the button that or change it it to agree the button's instance name
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
New Here ,
Mar 26, 2009 Mar 26, 2009
LATEST
ahh yes the Instance Name. totally passed that one by.
The file has exported with no errors, now all I need is to upload it and see if it works.

Thank you both very much for your help
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