Search

Let's say you had an external settings file that you wanted to load using the following code:

Actionscript:
  1. protected var _loader:URLLoader = new URLLoader();
  2. _loader.addEventListener( Event.COMPLETE, function():void { trace("settings.txt was loaded successfully"); } );
  3. _loader.load( new URLRequest("settings.txt") );

You finish writing your class, save your fla, and compile. After compilation completes, the code above properly trace s "settings.txt was loaded successfully" (assuming settings.txt actually exists in the proper location). Yay, it worked!

However, if you were to immediately run this swf file a second time, you would not see this trace statement. "Why not!?" you may ask in complete frustration after trying for 20 minutes to figure out what the heck is going on and have a few less hairs on your head and a few more in your clenched fists (or maybe that's just what happened to me).

By default, when you compile any class using the Flash IDE, it is automatically "trusted," but for this single execution of the swf file that immediately follows the compilation only. All other flash files run from your local system, by default, are not trusted. This means that they cannot access external assets (such as text files) or communicate using the network. This may seem frustrating when you're developing, but since the capabilities of the FP are growing so much, this is a very good thing or hackers would be going crazy and everyone would be very ticked at Adobe.

In order for local swf's to have further privileges, they must be "trusted." There are two main ways to "trust" a swf:

  1. Add the swf or folder containing the swf to the Global Security Settings panel
  2. Add the swf or folder containing the swf to the FlashPlayerTrust.

The first method can be completed by doing the following:

  1. Run any swf file.
  2. Right click on the swf file and choose "Settings"
  3. Click on the "Privacy" tab and click on "Advanced..."
  4. This should bring up a Flash Player Settings Manager website (note that steps 1-3 can be skipped by directly accessing this site).
  5. On the left-hand pane, click "Global Security Settings Panel"
  6. Click on "Edit locations..." and then "Add location..."
  7. Choose the file or folder that you wish to "Trust" and press "Confirm"

The second method can be completed by doing the following:

  1. Open the FlashPlayerTrust folder on your computer.
    • Windows: system\Macromed\Flash\FlashPlayerTrust
      • For example: C:\windows\system32 \Macromed\Flash\FlashPlayerTrust
    • Mac: app support/Macromedia/FlashPlayerTrust
      • For example: /Library/Application Support /Macromedia/FlashPlayerTrust
    • Linux: /etc/adobe/FlashPlayerTrust
  2. Create a new text file (any text editor should do) and call it whatever you want, but with a .cfg extension.
  3. Add the absolute path of the file or folder that you wish to to the text file.
  4. Save the text file.

Note that the locations listed above are for trusting flash content for all users. If you wish to trust content only for a specific user, use the following FlashPlayerTrust locations:

  • Windows: app data\Macromedia\Flash Player\#Security \FlashPlayerTrust
    • For example: C:\Documents and Settings\JohnD \Application Data\Macromedia\Flash Player \#Security \FlashPlayerTrust
  • Mac: app data/Macromedia/Flash Player/#Security /FlashPlayerTrust
    • For example: /Users/JohnD/Library/Preferences /Macromedia/Flash Player /#Security/FlashPlayerTrust
  • Linux: usr data/adobe/FlashPlayerTrust
    • For example: /home/JohnD/adobe/FlashPlayerTrust

For further information, see the flash_player_9_security.pdf white paper.

This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 3.0 United States License.

One Response to “Flash Player 9 Local swf Security”

    What about non-local files then? Any solution?

Something to say?

You must be logged in to post a comment.