Monday, June 16, 2008

Flex/Flash accessing both network and local files

Flash wants you to be safe, which means a swf you make cannot access the network (not even localhost!) and read local files. This can be a pain when you have a swf file you trust (e.g. when you wrote it yourself)! But the bigger pain is how badly Adobe document the workaround, especially if you are on linux.

First the answer. As root, make /etc/adobe/FlashPlayerTrust/. Then if your trusted swf, and its files are in /home/georgebush/killforoil/ you make a file called:
/etc/adobe/FlashPlayerTrust/killforoil.cfg
and in that cfg file you put this line:
/home/georgebush/killforoil/

George is now able to continue to screw the world without those Adobe do-gooders getting in his way.

Adobe document this (for Windows/Mac) here:
http://livedocs.adobe.com/flex/3/html/help.html?content=05B_Security_01.html

(Why am I saying the document it so badly? Because everywhere else I looked, they say using use-network=true when you make your swf file means it can never access local files.)

Once I knew that FlashPlayerTrust was the key word, I was able to find these linux instructions (which also tell you how to do per-user configurations):
http://www.abdulqabiz.com/blog/archives/flash_and_actionscript/flash_player_trust_f.php

3 comments:

nthere9 said...

hi,

I'm a newbie in Adobe Air-Flex-Flash Builder.
I'm trying to access and copy my files from network to my local.This process needs an authentication.So can you please explain this simpler?

darren said...

Hello nthere9, sorry I'm not too clear what your issue is; some of the security settings may depend on which platform you run the air program on. Maybe you can post a question (with much more detail about what you've already tried) on StackOverflow?

Buford Thornton said...

Hi Darren,

I am also new to the Flash environment and would greatly appreciate your assistance.

I have a PHP application which is supposed to serve up some Flash files. These files are big as it contains training content and videos. These Flash Files are distributed throughout our organization and is located on every PC in a specific location.

The end user serves to a training system on the intranet which does the tracking etc. This web app generates a page where the Flash located on the user computer must be displayed.

I have tried embedding the flash in the page by referencing "file://c:/path/to/file/name.swf" but this does not work. I have also created a container .swf file in the page and with ActionScript tried to load the same file path as above but I have had no success.

I have added the .cgf file in the FlashPlayerTrust folder on my PC but I am still not able to access the files on the local drive.

I am using ActionScrip 2 in my flash container an publishing to Plaer 8.

Could you please help me to get this up and running.