How To Open PDF File From Flash using Fscommand

Filed Under: Articles, Tip and Tutor by fandy February 23, 2011, 16:56


In last two weeks ago, I have case on my Flash project, using Flash CS5 with Action Script 3.0. I am creating a Flash application of a application tutorials to work on a CD. There is a manual documentation file in PDF format which the user can open the Pdf file.

The PDF file must be open in a separate, stand alone, not inside the flash or internet explorer. In this post I want to share who we can open the psf file in separate window with fscommand!

1. Write this Action Script, here’s my button instance name is "openPdf", and "manual.bat" is the file name of Batch file we want to call to open/execution the pdf file.

    function ():void
    fscommand ("exec", "manual.bat");


2. Create new folder the name is must "fscommand".

3. Copy the pdf file in folder /fscommand/

4. Open text editing tool, such as Notepad or Notepad++, create new one and type this codes

@echo off
start name_of_pdf_file.pdf

5. Save the text file as "manual.bat" or any name you like as same as the action script in our flash save it inside /fscommand folder.

6. Publish the Flash Document in Windows Projector (.exe). It would not running properly in swf movie file.

That’s it, but if you have better idea please put it in comment form



you can download the example project file below.

openPdf_example 2.55MB 5515 Example project file
click the attachment link to download the file

Written by fandy

a web and graphic designer whose love art and design and like to share knowledge, resources and inspirations. English not my mother language so don't blame me, I just do the best to sharing, just give me suggestion to fix it. If love my work, you can support me and follow me on Twitter

Share This :



deny March 3, 2011,16:07

I’ve try your solution , but it’s still doesn’t work though I’ve publish it in .exe file
please give me solution for this one , if you’re available, please send me an email
thanks a lot

    fandy March 3, 2011,16:43

    @Deny; Are you get some error? if so let me know what error?
    The key are ‘fscommand’ folder where the .pdf file and .bat placed.

deny March 4, 2011,07:22

@fandy , no , I’m not got some eror, but even I running that, it’s not work anymore , I mean it’s not call the .pdf file , just click click and nothing happen,
eh, may I know your facebook account? so we can tall more easy ,

deny March 4, 2011,07:27

@fandy , may I know your facebook account, so we can talk more easy,
I’m not got some eror , but even I click , nothing happen I mean that button not call file .pdf that I will, :(
please help me ….

    fandy March 4, 2011,07:36

    @deny, let me know your source project? send it to my email

deny March 4, 2011,07:40

what is your email?

    fandy March 4, 2011,09:59

    I sent you the email. But, I have update this post, you can download the example!

deny March 4, 2011,13:53

oh,okay, thanks a lot for your help
hmm… are you indonesian people? because you had send me an email with indonesian language ..
I’m indonesian people

deny March 4, 2011,14:01

is the scrip must in other layer of the button?
sorry I’m new in flash, hehe
with no teacher no book, just with application and internet

    fandy March 4, 2011,14:59

    @Deny, The srcipt can be in other layer but on same timeline.
    Indonesian? Yes I’m asli 100% :)

deny March 4, 2011,15:08

here i got some trouble,
in your sample, i see there is 2 frame, first frame is action and the second frame is for the button
when i see the action frame, i got your scrip, so i confused with this one, i mean about the action frame,
I sorry that i to much ask you
hope you will help me :)

deny March 4, 2011,15:43

my friend,
I’ve new problem
I try to make flash send an email with a form,
the way that I’ve do is connect the flash to dreamwaver and the DW will send the email
but it’s no work propely,
can you give me solution for this?another way maybe for sen an email with flahs?
thanks a lot

deny March 7, 2011,10:04

hy bro,
help me for this one to
I will make make project fit to all screen, I mean when my client open it, my flash automatic fit to all screen size,
how to make it real?
thanks a lot

    fandy March 7, 2011,15:04

    Add this script on first frame
    fscommand(“fullscreen”, “true”);

deny March 8, 2011,08:45

how to call a frame in one timeline?
need help.

Brett Widmann May 7, 2011,05:25

This was really helpful! Thank you.

Florian August 5, 2011,09:39

thanks for your example! you think it is possible to pass a parameter from flash to the bat file? for example to open different urls?
how would you implement the bat solution on mac?

do you know perhaps also other ways to open files or folders from flash player? many thanks,

jucelin August 23, 2011,09:24

Thanks for your example, but I have a question, how can I open a PDF document in flash player when we use it to show PDF document in my website? It just like

collen August 28, 2011,19:01

How do you open a pdf file using a TLF TEXT link? is this possible?

Xtian October 19, 2011,07:25

Hello… I would like to open a new swf from another swf. But i don´t want to open it inside the original swf, but in a new “swf window”… so when i click in the button in the original swf, a new swf appear, without desapearing the original swf. I hope you understand to me. Please help. Thanks.

    fandy October 19, 2011,10:14

    Hi Xtian, you can use this code “getURL(“myMovie.swf”,”_blank”);” it will open in new window

lytos November 17, 2011,05:53

Gracias. Muy útil la imformación….

serviover November 19, 2011,10:31

hey fandy,
I tried more time to do this. But still I can’t open my pdf and also ur example project can’t open Adobe flash cs3. what can I do???

Heather Cheek January 11, 2012,02:11

This worked BEAUTIFULLY for me. I was very lucky to find this as I spent half of my day trying to figure this out in CS5. I’m currently trying this method to open file folders.

Ren January 31, 2012,02:58

This was very helpful and saved me a lot of trouble!

I have a question:
Can you use this method multiple times in a single application? There are two things I need to open up, and using your method would work very well, but I tried to make a separate .bat file and both links stopped working. I may have done something wrong.

    fandy January 31, 2012,11:49

    @Ren, you can use this method multiple times with make multiple .bat files, in each button call different .bat file (ie. manual.bat, manual01.bat, manual02.bat) and each call different pdf.

amir February 24, 2012,23:06

Thanks man. It’s very useful for me :)

Masoud March 11, 2012,21:24

Hi Fendy, When I open a PDF with Fscommand and BAT, I can see CMD window. How can I hide that?
Pleas answer me by email. I don’t use internet too much!

Ting March 15, 2012,16:30

Hi Fandy,

I am using Flash CS5 on macintosh. Will you be able to show me what is the complete script for opening PDF with macintosh Flash CS5?


Noylin April 17, 2012,12:53

Thanks a lot!!! It’s the very thing I need!

Anand May 3, 2012,17:54

The Script is totally correct there is no errors in it what i am able 2 notice is that it works great when u publish it . The flash exe output works perfect the SWF has probs.

vanzel July 26, 2012,23:41

How Do I Open A Folder Or Directory?

yogesh September 25, 2012,18:48

hi Fandy,
i tried the way you have shown..but for some or the other reason its not working. Nothing happens when i click the button. also an error is reported as i publish exe…
“a type identifier is expected after ‘:’ “…
please help!
Thank you!

pb April 12, 2013,09:12


This works well, thank you!

But, I’ve not had luck on Windows 8…any suggestions? It looks the .bat file may need to be updated. Any helpful hints would be most appreciated.

Thanks again for putting this out there.

amir hossein monfared May 11, 2013,12:00

thanku….so useful..

chrishu June 24, 2013,19:43

very useful, thx mate !

Alex Leiva August 16, 2013,13:16

Very good tutorial!
Is it a way to open the pdf without a button, just after an animation instead? When it plays an specific frame in other words.



Your email address will not be published. Required fields are marked *





You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Community News

Recent Comments

    • dadan : Saya tempel linkback ya disini more
    • dadan : om, gan, aden, minta ijin untuk pakai motif batiknya ya... more
    • dadan : aden/agan/encep, boleh saya pakai ga motif batiknya?... more
    • ErNy : Numpang dload batiknya buat tugas, trims gan... more
    • Tom : Nice infographic!... more

Powered by:

Content Distribution Network

Twitter: ArtfanDesign