all groups > macromedia flash sitedesign > march 2006 >
You're in the

macromedia flash sitedesign

group:

Download PDFs


Download PDFs gohansol
3/31/2006 11:55:25 PM
macromedia flash sitedesign:
Hi!!

I'm new to Flash and building a website for myself right now. any kind of help
is appreciated!!!

I'm trying to make a button that when the user clicks on it he/she will
download a pdf file to their desktop.
Bascially i want to have people download my resume pdf file to their computer.
I know I could settle and have a pdf open in a blank browser and the user
could copy / save it to their computer but I want to be able to download the
pdf automatically when you click on the button.

Anyone has any idea as to how?

Thank you so much!!!

Re: Download PDFs wlutes
4/4/2006 11:04:36 PM
I used to be able to do this very easily in earlier versions of Flash but since
the MX series (and beyond wtih v8) I am only able to do it the following way:

Put the file on your webserver in a folder called: 'pdf' (sans quotes) and
have it at the same level as your .swf and html files in your directory
structure.

Within your flash movie you can use either a button, movie clip or text link.
There are two ways to put the file link in your flash movie (if text then use
the link field found in the properties panel; if a button/movie clip then use
the getURL method and select '_blank' for a window by using the Actionscript
'script assisted' panel). In BOTH cases use the full URL address like:

http://www.domain.com/pdf/filename.pdf (as an example)

The file will display in the "blank" browser window you defined in the getURL
Actionscript window. The end user can then decide to "save" the file or print
and close it or whatever.

Like I said, in earlier versions I used to be able to make a "relative URL" to
get the file in question and either display it in a window for the end user or
to download/run it. That way it didn't really matter if I moved the website to
another provider because the file was referenced locally within the same web
directory. Using the way I described above has the draw back that it is an
absolute reference to a URL so if you switch domains or providers, etc
(depending on your setup) then the link can be broken because it is absolute. I
have posted a 'getURL' question to find out how to do the relative getURL call
like before but so far there have been no takers on answering it. Will let you
know what I find out if someone does respond.

Best of luck!
AddThis Social Bookmark Button