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.
openPdf.addEventListener (MouseEvent.CLICK, 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
Updated!
you can download the example project file below.
[dm]30[/dm]
hy,,
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
@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.
@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 ,
@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 ….
@deny, let me know your source project? send it to my email
what is your email?
I sent you the email. But, I have update this post, you can download the example!
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
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
@Deny, The srcipt can be in other layer but on same timeline.
Indonesian? Yes I’m asli 100% 🙂
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 🙂
You mean 2 layers, in 1 frame. You can put the script on the second one layer also.
maybe you can get the solusion for your contact form issue, http://www.republicofcode.com/tutorials/flash/as3contactform/
and please ask/comment relevant to the article.
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
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
Add this script on first frame
fscommand(“fullscreen”, “true”);
bro,
how to call a frame in one timeline?
need help.
This was really helpful! Thank you.
Hi!
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,
florian
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 http://docs.google.com/viewer.
How do you open a pdf file using a TLF TEXT link? is this possible?
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.
Hi Xtian, you can use this code “getURL(“myMovie.swf”,”_blank”);” it will open in new window
Gracias. Muy útil la imformación….
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???
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.
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.
@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.
Thanks man. It’s very useful for me 🙂
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!
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?
Thanks.
Thanks a lot!!! It’s the very thing I need!
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.
How Do I Open A Folder Or Directory?
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!
fandy,
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.
thanku….so useful..
very useful, thx mate !
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.
Thanks!
Ladies & Gents , who got deny`s solution working fine , what adobe flash you are using ?
A very good tutorial.
Thanks