FORUMS: list search recent posts

need action script to open pdf

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
drar chandra
need action script to open pdf
on Feb 1, 2008 at 6:29:06 pm

hi there, I have searched a million places and can't seem to find the action script code to simply open a pdf.

here is what I want:
click on button and open a pdf in seperate window (ie. a resume)
I don't want it to be just another html page, I want it to open the actual pdf and be sied to it, I see this all the time and can't figure out the action script to do this.

thanks again for any help! I do always try to find things on my own before posting so I appreciate all who help!

Return to posts index

drar chandra
Re: need action script to open pdf
on Feb 1, 2008 at 7:49:03 pm

I should say this is the script I am using so far:
on (release) {

but it seems to be messy. I am viewing in firefox (browser) and it opens a blank page then opens it with previewer.
but when I view it in Safari it just opens it in a seperate blank window.
The getUrl method works but opens the PDF in an internet browser window. I don't want this to happen thought because I want it to open via Adobe Reader (my default PDF software). that way whomever is viewing has control to enlarge or shrink the pdf and have some control.

does this make sense?

thanks again!

Return to posts index

Pieter Helsen
Re: need action script to open pdf
on Feb 1, 2008 at 8:55:42 pm

If you have a php server at your disposal, create a .php page with the following code

header('Content-Disposition: attachment; filename=resume.pdf');

This will make your browser download the file as an attachment, rather than display it as a preview.

Or, you can use Flash's FileReference class. This is from the Adobe LiveDocs:
on (press) {
var listener:Object = new Object();

listener.onSelect = function(file:FileReference):Void {
trace("onSelect: " +;

listener.onCancel = function(file:FileReference):Void {

listener.onOpen = function(file:FileReference):Void {
trace("onOpen: " +;

listener.onProgress = function(file:FileReference, bytesLoaded:Number,
bytesTotal:Number):Void {
trace("onProgress with bytesLoaded: " + bytesLoaded
+ " bytesTotal: " + bytesTotal);

listener.onComplete = function(file:FileReference):Void {
trace("onComplete: " +;

listener.onIOError = function(file:FileReference):Void {
trace("onIOError: " +;

var fileRef:FileReference = new FileReference();
var url:String = "resume.pdf";
if(!, "resume.pdf")) {
trace("dialog box failed to open.");

Kind regards,

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved