csatblogspotdotcom

Wednesday, January 5, 2011

Flash Global Security Settings导致的程序出错

调一个和TUIO有关的AS3程序,结果一搞就出来了个什么已终止一项可能不安全的操作,计算机或网络上。。。本地程序***正在尝试与以下可访问Internet的位置进行通信:touchlib.com,要**通信,请单击设置。。。
结果整个firefox死在那里,强制关闭标签整个浏览器还是死掉。教程里已经写明了要设置Flash Global Security Settings,我也设了,在http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html里面添加了信任的目录“D:\Users\caishuo1234\我的工作”,后来又把这个目录里的我要执行的文件也加进去,没用,但我仍然怀疑是这个的问题。于是找到了这么个地方http://www.adobe.com/devnet/flash/articles/fplayer8_security.html,里面阐述了如何手动修改配置文件(用网页方式估计也是修改文件),先用“echo %appdata%”找到C:\Users\caishuo1234\AppData\Roaming,然后在\Macromedia\Flash Player\#Security\FlashPlayerTrust里面建了个MyTrustList.txt(UTF-8),加了D:\Users\caishuo1234\我的工作,还是不行,后来在整个电脑搜索,发现了C:\Windows\SysWOW64\Macromed\Flash\FlashPlayerTrust目录,在里面又建了个MyTrustList.txt,依然不行,奇怪了,我用网页上说的两种方法,一种通过在Adobe官网的界面上修改,另一种修改本地文件,同时用过了,为什么还是不行?我这下意识到错误提示里面没有正确的显示中文,于是想到文件名不能用中文,改过来之后终于OK。


整个过程我的几点心得:
1. 开发的时候还是用英文好。Adobe这么狠的公司的产品仍然出现这样的情况,无话可说。
2. 有的时候还是知道配置文件在哪里好,虽然这次不管配置文件的事。Adobe提供的网页上修改配置的方法很傻瓜,有它的优点,但对专业人员来说,还是知道里面的原理好。
3. 上次在洪老板那里调试,发现flash应用程序试图联网,选继续后一片空白的现象,现在我大概知道是什么情况了。刚才调试的时候有次在出现前面说的告警,关闭告警后出现了同样的错误提示:**试图联网**,并且给出了函数名。原来是本地flash 设置的一些问题。将对象添加进信任列表即可。
4. 发现以前的信任列表里有好多flash builder的东西,可以推断flash builder自动的把要运行的东西添加进 了信任列表里。为什么这次flash CS4就要自己加呢?
4. 在另一台机上出现同样问题可如下解决:直接进C:\Users\caishuo1234\AppData\Roaming\Macromedia\Flash Player\#Security\FlashPlayerTrust(Windows 7为例)把文件或目录添加到一个信任文件,同时路径里面不能含中文。万一出现中文,可将程序移出或目录改名。实在不能改目录名也不能改可执行文件的目录的,这可没辙,估计和编码有关,要再研究了。

下面贴下开发者的话吧:
from: http://www.adobe.com/devnet/flash/articles/fplayer8_security.html

•FlashPlayerTrust configuration files: These are simple text files that list trusted paths. They are intended to be created by executable installer programs. When an installer installs SWFs onto a user's computer, it can install trust configuration files to designate the SWFs as trusted. While this practice does not represent an explicit user decision about each SWF being trusted, the user has implicitly given their trust to the installer program by running it—it is, after all, an executable program. Flash Player recognizes trust configuration files in two locations: one that affects all users of the computer and one that affects only the current user. The all-users location has been chosen to require administrative privileges at the OS level. The locations are as follows:
•Windows all users:
\Macromed\Flash\FlashPlayerTrust

(e.g. c:\WINNT\system32\Macromed\Flash\FlashPlayerTrust)

•Windows single user:
\Macromedia\Flash Player\#Security\FlashPlayerTrust

(e.g. c:\Documents and Settings\fred\Application Data\Macromedia\Flash Player\#Security\FlashPlayerTrust)

•Mac OS all users:
/Macromedia/FlashPlayerTrust

(e.g. /Library/Application Support/Macromedia/FlashPlayerTrust)

•Mac OS single user:
/Macromedia/Flash Player/#Security/FlashPlayerTrust

(e.g. /Users/fred/Library/Preferences/Macromedia/Flash Player/#Security/FlashPlayerTrust)

These locations are directories, not individual files. Any number of configuration files may be installed in each of these directories; Flash Player will read all files it finds in them. Configuration files may not be placed in subdirectories of FlashPlayerTrust; they must be placed directly in the FlashPlayerTrust directories. The individual configuration files may be given any name but, to avoid naming conflicts, installers should name their configuration files in some way that is specific to their product. The FlashPlayerTrust directories will not necessarily exist on any given system, so installers may need to create them.

The syntax of these files is simple: They contain any number of local paths, one per line. Whitespace and blank lines are allowed. Comments can be included with the # character; these comments go to the end of a line. Quotes are unnecessary (and will cause problems) for paths that contain spaces.

These files contain filesystem paths, which on some users' computers may include non-ASCII characters, so the text encoding used in FlashPlayerTrust files is significant. Flash Player will look for Unicode byte-order mark characters at the beginnings of these files, and will recognize UTF-8 and UTF-16 byte order marks, treating the rest of the file as UTF-8 or UTF-16 accordingly. (Windows Notepad and Mac TextEdit, for example, can write Unicode text files containing these byte-order mark characters; many other text editors can as well.) If Flash Player does not find a byte-order mark character at the beginning of a FlashPlayerTrust file, it will interpret the file using the current "codepage" (default local encoding) of the computer.

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home