How to get Flex Builder 3 to create two assemblies: one "-use-network = true", the other "-use-network = false"?

I am creating a Flex application that should run in two different deployment scenarios:

Firstly, the application will be hosted on the Internet. SWF loads some external resources (images, text), so this requires network access, which is the default Flex Builder 3 build flag "-use-network=true". I do not need anything special; It just works.

Secondly, the application will be written to a CD with autorun enabled to run index.html, which hosts SWF. SWF should still be able to load the same external resources that are on the CD in the subfolder. Since these files are located on the CD-ROM, they are considered local, so Flash security requires that the SWF be created using the flag "-use-network=false". I am adding this to the "Advanced Compiler Options" text box found in the "Flex Compiler" in the Flex project properties dialog box.

Everything works as expected, but for the tedious, you need to manually change the settings of the Flex Builder project to add or remove this flag, depending on the situation.

Ideally, I would just like to build a project once and there are several output folders :. One for a network deployment scenario and one for a local deployment scenario

What is the best way to do this? Does Ant move to build a path, or is there an easier way? If the Ant build configuration is the right way, do you have an example to share such multiple build configurations?

Thank you for your help!

+3
source share
1 answer

Ant, . , ( ant, )

, Flex Ant , - ( ):

<?xml version="1.0" encoding="utf-8"?>
<!-- myMXMLCBuild.xml -->
<project name="My App Builder" basedir="." default="main">
    <taskdef resource="flexTasks.tasks" classpath="${basedir}/flexTasks/lib/flexTasks.jar" />
    <property name="FLEX_HOME" value="C:/flex/sdk"/>
    <property name="APP_ROOT" value="apps"/>
    <property name="DEPLOY_DIR" value="c:/jrun4/servers/default/default-war"/>
    <target name="main" depends="clean, compile1, compile2">
    </target>
    <target name="compile1">
        <mxmlc 
            file="${APP_ROOT}/Main.mxml" 
            output="${DEPLOY_DIR}/Main.swf"
            actionscript-file-encoding="UTF-8"
            keep-generated-actionscript="true"
            incremental="true"
            use-network="true"
        >
            <!-- Get default compiler options. -->
            <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>

            <!-- List of path elements that form the roots of ActionScript
            class hierarchies. -->
            <source-path path-element="${FLEX_HOME}/frameworks"/>

            <!-- List of SWC files or directories that contain SWC files. -->
            <compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
                <include name="libs" />
                <include name="../bundles/{locale}" />
            </compiler.library-path>

            <!-- Set size of output SWF file. -->
            <default-size width="500" height="600" />
        </mxmlc>
    </target>
    <target name="compile2">
        <mxmlc 
            file="${APP_ROOT}/Main.mxml" 
            output="${CD_DEPLOY_DIR}/Main.swf"
            actionscript-file-encoding="UTF-8"
            keep-generated-actionscript="true"
            incremental="true"
            use-network="false"
        >
            <!-- Get default compiler options. -->
            <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>

            <!-- List of path elements that form the roots of ActionScript
            class hierarchies. -->
            <source-path path-element="${FLEX_HOME}/frameworks"/>

            <!-- List of SWC files or directories that contain SWC files. -->
            <compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
                <include name="libs" />
                <include name="../bundles/{locale}" />
            </compiler.library-path>

            <!-- Set size of output SWF file. -->
            <default-size width="500" height="600" />
        </mxmlc>
    </target>
    <target name="clean">
        <delete dir="${APP_ROOT}/generated"/>
        <delete>
            <fileset dir="${DEPLOY_DIR}" includes="Main.swf"/>
        </delete>
    </target>
</project>

, Ant eclipse/Flash Builder, .

+7

Source: https://habr.com/ru/post/1716497/


All Articles