views:

970

answers:

6

I have a Flex app that does a a fair amount of network traffic, it uses ExternalInterface to make some javascript calls (for SCORM), it loads XML files, images, video, audio and it has a series of modules that it could be loading at some point...

So the problem is - we now have a requirement where the user needs to run this content locally on a machine that is not connected to the internet (which means they can't connect to Adobe's site to change their security settings.) As you can imagine, when the user doubles clicks on the html page to launch this thing, they are greeted with a security warning that the swf is trying to communicate with another domain other than the one it's in. We can't wrap it in an exe or an AIR app so I unless there is some way to tweak some obscure security settings we may be hosed. Any idea's?

A: 

Hi,

Did you try to specify the authorized domain with:

System.security.allowDomain("www.yourdomain.com");
jdecuyper
Well - the inherent problem is - I'm not excatly sure what the domain is going to be - since a user may run this from his hard drive there's no telling where he's going to put it. Although I could have a requirement that it be placed in hard drive root...hmmmmm, I'm going to have to try that!
onekidney
System.security.allowDomain("localhost"); ?
I Never Finish Anythi
A: 

I hesitate to say "you can't do it", but in my experience, there's no way to do what you're describing. Anyone, if I'm wrong, I'd love to know the trick.

matt lohkamp
I'm finding that to be true too. :(
onekidney
A: 

Sorry that I haven't actually tried this to see if it works or not ... but ...

Page 20 (and/or 26) of this document may be of help. The document is referenced here. In a nutshell it describes directories which contain cfg files which in turn contain lists of locations on disk which should be regarded as trusted. An installer for the application would then be responsible for creating appropriate .cfg files in the desired location (global or for the installing user).

imaginaryboy
A: 

The short answer is that if your swf is compiled with use-network to true, it isn't going to work.

Is it possible to compile a version with use-network to false? Or is it running on an Intranet that is closed off from the Internet and still communicating with the LMS?

+5  A: 

What you are trying to do is exactly the problem solved by AIR. You should really give it a try, it's not that hard to pick up. If you really really can't use AIR (you didn't specify why, so I assume it's just because you don't want to have to learn a new system), then modifying the security config file will solve the problem.

Basically what you need to do is create a 'trust' file in the "Global FlashPlayerTrust" directory. This can be done by your installer (which installs all the javascript, SWF, html, etc files onto the local machine). You should create the directory if it does not exist. The directory for each OS is:

  • Windows - %WINDIR%\System32\Macromed\Flash\FlashPlayerTrust
  • Mac - /Library/Application Support/Macromedia/FlashPlayerTrust
  • Linux - /etc/adobe/FlashPlayerTrust

Next, you need to create the trust file. You can name it anything, so pick a unique name that would be unlikely to conflict with others. Something like CompanyName.cfg. It's a text file, with one path per line. You can trust either one SWF at a time, or an entire directory. Example:

C:\Program Files\MyCompany\CoolApp
C:\Program Files\MyCompany\OtherApp\Main.swf

To test that it's working, inside your flash movie you can check System.security.sandboxType (ActionScript 1 or 2), or Security.sandboxType (ActionScript 3). It should have the value of "localTrusted"

davr
Hey - I'd love to use AIR but the client won't allow any "installables." >.<
onekidney
Wont allow "installables"? Then how do you plan to install the html/js/xml files? Wont that require some kind of installer?
davr
A: 

It is possible. Please chek that the swfs you are calling from the main swf have the "Access local files only" property enabled or not.

Syam Lal S.