开发者

Loading XML locally with AS3

开发者 https://www.devze.com 2023-03-25 12:35 出处:网络
I have a project in Flash Builder and I use Bulkloader to load some configuration files. When I run the project from Flash Builder or in a server, everything works as expected, but when I run the SWF

I have a project in Flash Builder and I use Bulkloader to load some configuration files. When I run the project from Flash Builder or in a server, everything works as expected, but when I run the SWF from another location (for example "my documents"), the project 开发者_如何学Pythoncan't load the XML.

I'm not sure if this is a security problem or something similar.

Thanks in advance!


You need to use this settings manager to add locations that are safe for your SWF to access data from.

         It should end up looking something like this:

       

Loading XML locally with AS3

Use the Add location feature to add the drive that your My Documents folder is contained within.


Assuming that you are developing a WebApplication and not an AIR desktop application, you are allowed to access either network files or local files, but not the both of them. When you run from FlashBuilder, your program is executing from a SandBox and such restrictions won't apply, how ever when you deploy outside, you will get a security error.

If your application does not need to use any network features, you can specify use-network=false as part of the compiler options which will allow you to access local files.

To add/change Compiler options, Right click on your project in Flash Builder, select Properties, then Flex Compiler, and enter the option in Additional Compiler arguments. (I am using Flex Builder 3, so it might be different on the Flash Builder that you are using)

Flex Compiler Options

0

精彩评论

暂无评论...
验证码 换一张
取 消