How to E Mail a Link in Flash Actionscript

In this article, you will learn how to email a link using ActionScript for Flash. You will be creating a few buttons with code to send an email through any video/movie or other media you have created. This article does not teach you how to create a video or movie. This article is for Flash users who have some experience creating movies. There are some useful links in this article for learning how to make a Flash movie. Learn how to create actions that will allow your movies to send an email via a link created in Flash ActionScript.

Things You'll Need

  • Pre-created Flash movie or other media
  • Flash
  • ActionScript 2.0/3.0
  • PC computer
  • Internet connection (ISP)
Show More

Instructions

    • 1

      Draw a button with your rectangle tool.

    • 2

      Assign three text input component instances: email address; email subject and email body.

    • 3

      Assign the instance name to each of the input components you just created. Assign the first component an instance name of “to”. Assign the second component and instance name of “subject”. Assign the third as “body”.

    • 4

      Assign the navigation action to the button you created. If you are using ActionScript 2.0, the navigation action will be “getURL”. If you are using ActionScript 3.0 then you will assign “navigateToURL”.

    • 5

      Create an email link for a button. Begin by drawing a new button with the rectangle tool. Assign an instance name in the Properties Panel.

    • 6

      Add a new layer on the Timeline pane and give it a name: “Action”. Then select the first keyframe on the Actions layer.

    • 7

      Press F9 (Function key) or open the Actions Panel under the Windows menu.

    • 8

      Assign the action to the instance in the Actions Panel. To do this you will need to type some code. There are different codes for different versions of ActionScript. Type the following code for ActionScript 2.0 (Skip this step if you are using a higher version): myButton.onRelease = function() { getURL("mailto:"+to.text+"?subject="+subject.text+"&body="+body.text); };

    • 9

      Type the following code for ActionScript 3.0 (skip this step if you are using a lower version): import flash.events.MouseEvent; import flash.net.*; function openPage(event:MouseEvent):void { var request:URLRequest = new URLRequest("mailto:"+to.text+"?subject="+subject.text+"&body="+body.text); navigateToURL(request, "_blank"); } myButton.addEventListener(MouseEvent.CLICK, openPage);

    • 10

      Save your work. Click the Send button. Your link will be emailed via the ActionScript code in Flash.

Related Searches:

Resources

Comments

You May Also Like

Related Ads

Featured