Including configuration files while compiling a Flex application with MXMLC
- by Daniel
Hello there,
I'm using:
- Flex SDK 3.5.0
- Parsley 2.2.2.
- Flash Builder 4
Down in my src folder (which is configured as part of the source path in the Flash Builder), I have a logging.xml which I configure via Parsley:
FlexLoggingXmlSupport.initialize();
XmlContextBuilder.build("com/company/product/util/log/logging.xml");
When I run my application through Flash Builder, the XmlContentBuilder seems to locate the logging.xml (the implementation is a regular URLLoader one).
When I compile my application using MXMLC (whether in Ant or command-line), and then run the swf, I get the following error:
Cause(0): Error loading com/company/product/util/log/logging.xml: Error in URLLoader - cause: Error #2032: Stream Error. URL: file:///C|/workspace/folder01/product/target/com/company/product/util/log/logging.xml - cause: Error #2032: Stream Error. URL: file:///C|/workspace/folder01/product/target/com/company/product/util/log/logging.xml
Here is the MXMLC tag in Ant:
<mxmlc file="${product.src.dir}/com/company/product/view/Main.mxml" output="${product.target.dir}/${product.release.filename}" keep-generated-actionscript="false">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
<!-- source paths -->
<source-path path-element="${FLEX_HOME}/frameworks" />
<compiler.source-path path-element="${product.src.dir}" />
<compiler.source-path path-element="${product.locale.dir}/{locale}" />
<compiler.library-path dir="${product.basedir}" append="true">
<include name="libs" />
</compiler.library-path>
<warnings>false</warnings>
<debug>false</debug>
</mxmlc>
And here is the command line:
\mxmlc.exe -output "C:\temp\Rap.swf" -load-config "C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\sdks\3.5.0\frameworks\flex-config.xml" -source-path "C:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\sdks\3.5.0\frameworks" C:\workspace\folder01\product\src C:\workspace\folder01\product\locale\en_US -library-path+=C:\workspace\folder01\product\libs -file-specs C:\workspace\folder01\product\src\com\company\product\view\main.mxml
Now perhaps I don't get this correctly, but as far as I understand the SWF should be compiled with all of the resources in the paths I give MXMLC as source-paths. For some reason it seems that the XML file is not compiled into the SWF, hence the relative path of the XmlContentBuilder isn't located successfully.
I could not find any argument to provide the MXMLC with that might solve this.
I tried using the -dump-config option with the Flash Builder's compiler, then giving that configuration to MXMLC, but it didn't work either.
I tried providing the XmlContentBuilder with an absolute path. That worked fine when I compiled with MXMLC via Ant, but still didn't work when I used MXMLC in the command-line...
I'd be happy to be enlightened here, regarding all subjects - using MXMLC, accessing resources with relative paths, configuring logging in Parsley, etc.
Many thanks in advance,
Daniel