views:

863

answers:

3

I have a swf that is run from C:/ in the browser instead of a server (long story) and that swf loads a video that it located at ../../videos/video in relation to that swf.

Problem is, When I run it in Flex, everything is cool. Running locally, it can't find the file (not a security error) and is throwing a connectionError.

Any ideas?

NOTE: This seems to be a Windows specific problem, it's running on my mac with the same security settings just fine.

A: 

Are you absolutely sure it's not a security error hiding behind the connection error? Did you try setting up a local trusted directory to run your content from?

fenomas
+2  A: 

Flex Builder has a file that it adds all of your bin directories to in order to allow the debug player to get around the local security restrictions.

Here's a blog post on the subject.

Essentially Flexbuilder tells Flash that it should trust the bin folder... if you do a search on your development machine for the file flexbuilder_plugin.cfg, you should find it in a folder called FlashPlayerTrust in roughly the same area you normally find SharedObject files. If you open this file in a text editor, you should see pretty much every path to every bin folder for every flex project you have ever worked on. And suddenly everything gets so much clearer.

You can do as fenomas suggests and add any directory to your trusted list. You can also follow the advice from the above blog post.

So I created a new file and placed it next to this flexbuilder_plugin.cfg file, and called it MyProggy.cfg. Flash is configured to read in all files in this folder and parse all paths out of it, and any applications run from these paths will be considered "localTrusted" and will act as they would when run from Flexbuilder. Inside this text file I put one line: "c:\program files\my proggy" and saved it. I then had to restart Firefox for the change to take effect. I also had added a text label to my application and bound the text property to {Security.sandboxType}.

James Fassett
Hmm, didn't know FB had its own parallel trust file. Thanks for the info!
fenomas
+1  A: 

I would suggest getting HTTPFOX for Firefox which is a sniffer. Then you can see what is failing. In my own search I found that FLV's are always relative to the SWF, even when loaded on the WEB. Every asset that I have loaded is relative to the index.html file except for FLV's which always remain relative to the SWF. Being able to watch the data flowing, or attempting to flow to your site is invaluable.

This also explains why some people have no issue loading thing locally but then run into problems on the web. If their html file that is loading the swf is in a different location than the swf then every asset other than FLV's have a different relative path when viewed online then they do when viewed locally.

<3AS3

Brian Hodge