A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Calling external .PDF from Projector file (.exe)

  1. #1
    Junior Member
    Join Date
    Oct 2008
    Posts
    25

    Calling external .PDF from Projector file (.exe)

    Guys,

    I hate to be that guy who asks redundant questions, so I do apologize. I read through this thread and, although it seems to apply very closely to my situation, I could not help myself!

    My problem: I am distributing a Flash program (Projector, .exe) via CD. The "mother" file is called main.exe; it calls several other *.SWF files from a local folder called "swf". (I'm a simple guy..) There are also external JPEG images used in the program. Naturally the pictures are compressed in the SWF files and therefore lose quality.

    I want the user to be able to click a button in the program and open a .PDF or .JPG file, separate from the program itself. That way, they can save the file, print it, email it, etc.

    I'm sure this exact question has been asked before, so again I apologize for the redundancy. If you guys would point me to another thread that deals with my situation more accurately, or take the time to show me specifically, I would really appreciate it.

    Thanks a lot,


    theRiver
    Last edited by theRiver; 10-06-2008 at 04:21 PM.

  2. #2
    Junior Member
    Join Date
    Oct 2008
    Posts
    25
    This is what I've tried so far, with no success:

    A) Created a .BAT file (openPDF.bat), with contents:
    @echo off
    start "myPDF.pdf"
    end
    With the call from the Flash Projector executable:
    myBTN.onRelease = function() {
    fscommand("exec", "openPDF.bat");
    }
    Publish the flash projector file (all files in the same folder). Run it. Nothing.


    B) Created a .BAT file, openPDF.bat, contents:
    Reader\AcroRd32.exe /A "myPDF.pdf"
    and saved the file in a folder called "fscommand".

    Then I copied the Adobe Reader folder (yes, the entire contents, .dll files and all) into the fscommand folder. I copied "myPDF.pdf" into the fscommand folder, AS WELL AS its parent folder (wasn't sure where it was being called from). I published the Projector file with this is the action in the first frame:
    myBTN.onRelease = function() {
    var File = "openPDF.bat";
    fscommand("exec", File);
    }
    I copied the Publisher file into fscommand and its parent folder. Ran it from both locations.

    The file located within fscommand did nothing whatsoever. The file in its parent folder, however, flashed a black "Command" window briefly, then it closed and nothing else happens.

    No PDFs opening up, and aside from the flash of Command window, essentially nothing happens. This is driving me crazy because I've read a lot of threads on here that are very similar but just don't seem to work for me.

    Any ideas?


    Thanks a lot!

    e

  3. #3
    Junior Member
    Join Date
    Oct 2008
    Posts
    25
    Answered my own question. Sorta

    I decided just to use getURL() method instead. On Windows, there is no problem calling a local .PDF into a (default) web browser - at least not into IE or Firefox. However on Mac, it tries to download the already local file, then opens in Preview.

    Thank God I'm not writing this program for mac........


    e

  4. #4
    chrixlee
    Guest
    Too bad, the getURL() code didn't work out for me.

  5. #5
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766
    Here are the steps you need to follow to be able to open a file without the ugly DOS box that appears when you normally do this from Flash...

    1. Create a BAT file called pdf1.bat that contains just the following line. This is just a simple text file that you create with notepad or your favorite plain text editor.

    start pdf1.pdf

    2. Put the BAT file in a folder called fscommand along with a copy of proxy.exe.

    3. Rename the copy of proxy.exe to pdf1.exe (same base name as the BAT file you created).

    4. Place your PDF document (called pdf1.pdf) in the fscommand folder with the BAT and EXE files. You don't have to store the files you want to open in the fscommand folder, but for your first test this makes things easier.

    5. Add the following command to your FLA where you want to open the word document (probably on a button release action).

    fscommand("exec", "pdf1.exe");

    Now put your Flash EXE and the fscommand folder on your desktop and run the Flash EXE. When the EXEC command is called your PDF document should open.

    You will need one BAT file and one EXE file (renamed copy of proxy.exe) for every file you want to open from Flash. The reason for this is that Flash doesn't allow you to pass parameters using the EXEC command.
    When your swf2exe tool just HAS to work
    there's only one choice... SWF Studio

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center