软硬度:找出当运行的SWF编译?软硬、SWF

2023-09-08 13:32:09 作者:一挽青丝

反正是有在Flex应用程序找出(在运行时),当运行的SWF编译?

Is there anyway in a flex application to figure out (in runtime) when the running swf was compiled?

我想在服务器上的SWF的最新文件版本比较这并检测是否有在服务器上较新的版本,如果是强制用户重新加载他们的浏览器来获得新的版本。

I'd like to compare this with the latest file version of the swf on the server and detect if there's a newer version on the server and if so force the user to reload their browser to get the new version.

我需要这也与从缓存主权财富基金的工作。

I need this to also work with swfs from the cache.

推荐答案

我常做,以确保用户获得一个Flash文件的最新版本(因为有一些奇怪的与Flash内容的缓存)是使用一个服务器端脚本附加文件被修改的时间。

What I normally do to make sure the user gets the latest version of a Flash file (because there is something weird with the caching of Flash content) is to use a serverside script to append the time the file was changed.

我也一直在尝试用在SWF设置变量,尽管这需要一些命令行欺骗,如果你不使用一个构建脚本不会真正成为现实。

I've also been experimenting with setting variables in the swf, although that requires some command line trickery and won't really be practical if you're not using a build script.

基本上你添加到您mxmlc的电话:

Basically you append this to your mxmlc call:

-define+=BUILD::DATE,"2008-12-10"

那么变量BUILD ::日期将提供您的构建过程中,所以你可以用它来设置上,你以后要阅读静态变量:

Then the variable BUILD::DATE will be available during your build, so you can use that to set at static variable which you later read:

private static var COMPILEDATE:String = DATE;

(我写这一切从内存中,因此它可能不是100%正确syntaxwise)

(I wrote all this from memory so it might not be 100% correct syntaxwise)