The security restrictions of flash and Flex are a headache for programmers, especially when accessing local and remote resources. Often, separate settings are required, which can cause a lot of trouble during debugging. The method to fix the problem of not being able to access or restrict access to local files during debugging is simple. Just add the following to the flash/Flex compilation options: -use-network=false. Here's how to add it:
Project -> properties -> flex compiler ->
Add compilation command parameter:
-use-network=false
Of course, this command means that the compiled swf file cannot access the network and can only be used locally.
For flash, there are not many restrictions during debugging. Local files can be used, but if you need to access the network, you need to set it in the flash player.
However, when generating SWF files in flash, there is an option for the runtime environment, which allows you to choose whether it can only access remote files or only access local files. Setting it to local allows you to access local files, while the network option works the opposite way.
Finally, here is a list of compiler parameters for Flex (cnblogs: 宋欢的博客):
-
, -keep-generated-actionscript=true: Generates AS code during compilation and puts it in src/generated.
-
, contributor name: Adds the contributor's name to the swf file.
-
, creator name: Adds the author's name to the swf file.
-
, date text: Adds the content of the data to the swf file.
-
, default-background-color int: Sets the default background color. Default is null. Example: -default-background-color=0xCCCCFF.
-
, default-frame-rate int: Sets the frame rate. Default is 24.
-
, description text: Adds the description content to the swf file.
-
, dump-config filename: Outputs the configuration content to the file specified by filename. Example: mxmlc -dump-config myapp-config.xml.
-
, show-binding-warnings=true|false: Displays warnings when flash player cannot detect them. Default is true.
-
, runtime-shared-libraries url [...]: Specifies a series of runtime shared libraries. If library.swf is in the web_root/libraries directory, you can use libraries/library.swf to call it.
-
, optimize=true|false: Optimizes AS to reduce file size and increase performance. Default is false.