加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

actionscript-3 – 定义动作脚本

发布时间:2020-12-15 02:11:19 所属栏目:百科 来源:网络整理
导读:我正在尝试将构建号从Hudson传递到Flex应用程序. 我找到了关于条件编译的Adobe文档(http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_21.html),它似乎应该解决它但我必须遗漏一些东西. 所以在我的ant构建文件中我有: – mxmlc file="${a
我正在尝试将构建号从Hudson传递到Flex应用程序.

我找到了关于条件编译的Adobe文档(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命名空间,但这是一个流行的约定.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读