A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: FREQUENTLY ASKED QUESTIONS -- FAQ -- READ THIS BEFORE YOU POST

Hybrid View

  1. #1
    Senior Member SJT's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    2,563
    Q7. How do I open a document with an FS Command?

    A. There are two options here, use Macintosh path syntax or Applescript

    You can only open applications from the standalone Flash Player, being able to do this throught the plugin would be an immense security breach...

    Option 1)
    Use FSCommand to open documents, but use Macintosh path syntax.
    So if you wanted to open a file in a "data" folder:
    FSCommand("exec","data:myfile.pdf");

    OS X users should use the standard slash (/) notation, as this is the normal syntax, (the same as a URL) which will work fine.

    [ci-berpages, edited by SJT]

    Option 2)
    You can also create a custom applescript and compile it as an application which flash can then launch.
    Copy the following code into Script Editor, found in the Applescript folder in your Apple Extras folder.

    Code:
    --set the name of the file to open 
    property fileName : "thedocument.pdf"
    --get the path to the containing folder 
    set myPath to (path to me as string)
    set AppleScript's text item delimiters to ":"
    set the parentFolder to ¬
    	((text items 1 thru -2 of myPath) & "") as string
    set AppleScript's text item delimiters to ""
    -- find the flash file 
    try
    	set targetFile to alias (the parentFolder & fileName)
    on error
    	--ie if there's no  file here by this name, it will quit. 
    	return quit
    end try
    tell application "Finder"
    	open file targetFile
    end tell
    In the second line of the code there is a variable declared called fileName, you need to change the value between the double quotes to the name of your document.
    Then choose Save As in Script Editor.
    Change the dropdown menu to read "Application" and set the checkboxes so that "Never show splash screen" is checked and "Stay open" is unchecked.
    Save your script as a useful name, then put it in the folder with the document you want to open.

    Finally, in your flash file enter the FSCommand and use the name of your script as the name of the application.
    e.g. fscommand("exec",myscript);

    [SJT, Applescript derived from help at http://www.apple.com/]
    Last edited by SJT; 10-02-2003 at 07:24 PM.
    Sam



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