written by: S Wood•edited by: Amy Carson•updated: 11/10/2010
Use a button symbol in a Flash movie, in a page of your website, to link a PDF document to the symbol. This tutorial illustrates how to link PDF documents to buttons in Flash with ActionScript 2.0.
slide 1 of 1
How to Link PDF Documents to Buttons in a Flash Movie with ActionScript 2.0
With this step-by-step tutorial on how to link PDF documents to buttons in Flash, allow users to access PDF files from Flash content in your web page. What are the main steps to open a PDF file from a Flash movie button? First, create a button symbol. Second, place an instance of the button on the stage. Third, assign the ActionScript 2.0 code to the button. The program should contain the On event handler and the getURL method. Pass the name of the PDF file you wish to open as a parameter to the method.
Here are the steps on how to link PDF documents to buttons in Flash:
1. Start Flash.
2. Create a Button: Click Insert > New Symbol. The Create New Symbol dialog appears. NOTE: Keyboard shortcut to insert a new symbol – Ctrl+F8.
3. Type a name for the symbol in the Name field. For this tutorial, the name of the button is PDF Button. Click the Button radio button in the Type choices.
4. Click OK. The symbol editor opens.5. Draw the Button: Use the rectangle and or other drawing tool and draw a button. The button you draw applies to the Up state of the button.
TIP: If you already have a button, say as a JPEG file, and wish to use the same, click File > Import > Import to Stage and select a file from the Import dialog.
In the timeline, above the stage, there are frames for each of the four button states: Up, Over, Down, and Hit. If you wish to create a button effect for each of the last three states, here are the steps:
Right-click the cell immediately below the Over label. From the menu select, Insert Keyframe.
Repeat the above step for the Down and Hit States.
Modify the buttons, for example change the colors, for the last three states. Make sure to maintain the same dimensions of the buttons in all the states.
6. Click the Scene 1 link to return to the scene mode.
7. Insert an Instance of the Button on the Stage: Click Window > Library. The Library window appears.
8. Drag the button symbol from the window to the stage.
9. Use the Selection Tool to position the button on the desired location on the stage.
10. Now here’s the part you’ve been waiting for - How to Link PDF Documents to Buttons in Flash: Assign the ActionScript 2.0 code to the button.
Right-click on the button. From the menu, select Actions.
The Actions window opens.
11. Double-click the getURL method in the top-left pane of the Actions window. Flash inserts the skeleton code.12. In the URL field on the top-right, type the path to the PDF file on your server. Ensure the path is correct and also check for typos in the URL.13. If you wish to open the PDF file in a new tab, select “_blank" from the Window field.