gpt4 book ai didi

actionscript-3 - 在 ActionScript 中定义

转载 作者:行者123 更新时间:2023-12-04 04:26:51 25 4
gpt4 key购买 nike

我正在尝试将 Hudson 的内部版本号传递到 Flex 应用程序中。

我在条件编译上找到了 Adob​​e 的文档( http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_21.html ),这似乎应该可以解决它,但我一定遗漏了一些东西。

所以在我的 ant 构建文件中,我有:-

<mxmlc
file="${app.dir}/${application.name}.mxml"
output="${dist.dir}/${application.name}.swf"
context-root="${application.name}"
debug="true"
locale="${locales}"
allow-source-path-overlap="true">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<compiler.library-path dir="${lib.dir}" append="true">
<include name="*.swc" />
</compiler.library-path>
<define name="BUILD::BuildNumber" value="'20100707.800'"/>
<source-path path-element="${src.dir}"/>
<source-path path-element="${cfg.dir}"/>
<source-path path-element="${locale.dir}" />
</mxmlc>

然后我试图检索
public static const buildNumber:String = BUILD::BuildNumber;

但是编译器拒绝:

SomeModel.as(31): col: 47 Error: Access of undefined property BUILD.
[mxmlc] private static const _buildNumber:String = BUILD::BuildNumber;



有什么建议?

最佳答案

这里的其他建议的组合似乎有效。

这应该在您的 build.xml 中(假设您的 build.xml 在此之前已经为 BUILD_NUMBER 分配了一个值):

<mxmlc>
...
<define name="CONFIG::build" value="&quot;${BUILD_NUMBER}&quot;" />
...
</mxmlc>

注意 &quot;的使用没有任何引号。另请注意,您可以将此语法与 compc 一起使用。

那么你的 ActionScript 代码可以是这样的:
public static const buildNumber:String = CONFIG::build;

我认为您不一定需要使用 CONFIG 命名空间,但这是一个流行的约定。

关于actionscript-3 - 在 ActionScript 中定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3195518/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com