How to Link PDF Documents to Buttons in Flash – A Step-by-Step Tutorial with Screen Shots

How to Link PDF Documents to Buttons in Flash – A Step-by-Step Tutorial with Screen Shots
Page content

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.

library window

NOTE: Keyboard shortcut to open the Library window – Ctrl+L. If you use Mac, here are the Flash keyboard shortcuts.

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.**

type the URL

**13. If you wish to open the PDF file in a new tab, select “_blank” from the Window field.

14. Here’s the complete code:

on (release) {

getURL(“", “_blank”);


15. Publish and test your movie: Click File > Publish to create the HTML file, with the SWF file embedded in it, and test your movie.

TIP: Publish and test your movie first locally by pointing the URL to a local PDF file. The URL need not begin with “file://”. Just type the absolute or relative URL.

Say you have a file “brochure.pdf” in a folder called “sales”. Further if the folder and the SWF file are on the same level, then type the URL as sales/brochure.pdf.