How to Open Mail Links in Flash CS3 AS3
Flash's popularity stems from its ability to deliver over a variety of web browsers and operating systems, including handheld devices, such as phones. In Flash, you can set a link for users to open their default mail program just like in HTML. This provides users with a quick way to access you for questions, comments and even sales.
Instructions
-
-
1
Open Flash and click "File," then "New" and then click "Flash File (ActionScript 3.0)" from the pullout menu.
-
2
Click on the "Rectangle" tool from the tool bar and while holding down your mouse, drag across the stage to draw a rectangle. Click on the "Text" tool and type "eMail" on top of the rectangle.
-
-
3
Click on both the "Rectangle" and the "eMail" text to highlight and then from the main menu click "Modify." Click on "Convert to New Symbol" from the pullout menu. Click on the "Button" radial box and type in "eMail" for the name.
-
4
Click "Window" from the main menu and then click "Properties" and then "Properties" again from the pullout menu. With your background and text still highlighted, type in "mailto_btn" for the "Instance Name" in the "Property" panel.
-
5
Create new layers by clicking on "Insert Layer" located at the bottom of your timeline. Name your two layers by double clicking on the text and typing in a first layer "Actions" and the second layer "Labels."
-
6
Right click on frame "1" of your "Action" layer and then click "Action" from the pullout menu. Type in the following code:
mailto_btn.addEventListener(MouseEvent.CLICK, mailto);
function mailto(event:MouseEvent):void {
var email:URLRequest = new URLRequest("mailto:example@yourdomain.com");
navigateToURL(email, "_blank");
}
-
7
Test your button by pressing "Ctrl + Enter" on your keyboard.
-
1