Compiling MXML files into multiple SWF files using mxmlc compiler - apache-flex

I have a few mxml files that I want compiled into their respective SWF files using a configuration file. At the moment I can get 1 mxml file compiled into it's respective SWF file by using the file-spec attribute in the configuration file but how would I go about compiling multiple mxml files at once? Do I have a separate configuration file for each? I'm using MSBUILD and the mxmlc compiler.
This is how I specified the mxml file to be compiled:
<file-specs>
<path-element>..\somePath\myFile.mxml</path-element>
</file-specs>

Related

PhpStorm compile Less folder to style.css

I have a folder with Less files, split in parts to have a cleaner workspace. But I want them to be compiled by PhpStorm to 1 file (styles.css in a css folder). I installed lessc and it compiles the files separate. See picture 1
As I said I would like to have all files combined into css/styles.css But I don't get this configured right. My configuration is as followed:
I hope someone can explain what arguments I could use.
When Track only root files option is enabled in Less file watcher settings, file watcher produces a single .css file with name matching your "main" .less file (the one that imports all your "partials") that includes the merged content of all your .less files. No individual .css files for partials are created

How to update a JAR file with a modfied Java file

I have one JAR named as abc.jar with 15 class files. In JAR file I need to modify xyz.class, so I decompiled to xyz.java and modified it.
How can I update that JAR with the modified Java file? While trying to create (compile) the JAR file I am getting errors.
You can add your newly compiled class to the jar and overwrite the old one, here is how to add xyz.class and xyz.java to the jar :
jar uf abc.jar xyz.class xyz.java
See here for more about updating a jar file.
Or simply you can use any archiving tool, like winrar to open and add files to the jar.
Compile the xyz.java and replace the xyz.class file directly in jar without building the jar again, if the single class has been modified.

use a style.css file from a .swc and build the Flex project with ANT

I have an .SWC library with a style.css file inside.
The .SWC file is added to my project and the style.css is used this way:
<fx:Style source="assets/style/style.css" />
If I want to build my project with an ANT-script it says that "the external stylesheet couldn't be found".
In ANT you need to write the path for assets with an leading "/". So this would work:
<fx:Style source="/assets/style/style.css" />
But in this case it isn't possible to retrieve the style.css from the .swc as the compiler says that "the external stylesheet couldn't be found".
Is there any way to use the style.css inside the .swc AND use ANT to build the project?
resolved:
problem was within the compiled SWC.
I've forgotten to say the ant file to add the style. When I checked the SWC, I checked the SWC compiled by the Flash Builder and not by the ant script.

Compiling flex modules into swf with other mxml files in ant

I have a huge project with many mxml and as files and am trying to compile them all into one working swf file using ant. However, I'm having trouble compiling main.swf correctly in ant.
It doesn't seem to be pulling in the necessary modules, all of which are located in separate folders within the main src folder.
It will compile without error, but when I open the swf file, there is no content -- just a shell. However, if I compile using flex builder 3's compile button, it will create the swf correctly -- content and all.
Even when using a simple mxmlc command, it throws an error for any file associated with the modules saying there is an unknown type (meaning it's not pulling in the modules).
Is there a special way that modules should be dealt with when trying to compile them into a main.swf file using ant?
Did you include a library-path element in your Ant build file?
e.g.
<target ...>
<mxmlc output="...../file.swf"
....
file=".../main.mxml">
<library-path dir="..../" append="true">
<include name="...../someModule.swc"/>

How do I create a jar file, which includes xml and html files?

I am trying to create a jar file which includes some class and java files needed, but I also would like to include some extra xml, xsl, html, txt (README) files.
I am using Eclipse on Windows XP.
Is there an easy way for me to set up a directory structure and package all my files into a jar?
Add the files to a source folder and they can be included in the jar.
One common way is to have, at the root of your project, a src folder. Within that, folders for java files, and others. something like:
src/
css/
java/
html/
images/
Then you can make each of those subfolders a source folder (Right click, Use as Source Folder) and they should be available to add to the jar.
A .jar is nothing but a ZIP archive, so you can use any program capable of creating ZIPs. Just make sure that you include the manifest and all the class files.
I just added all the files into my Eclipse project (including the txt, html, xml, etc files).
Then I used Eclipse to File->Export->Jar File->Next
Check the "Export Java source files and resources" box.
Done.
If you're using Ant, you can use the jar task (see the examples section for how to include/exclude certain files, etc.)
If you move to an ANT (or Maven, for you Maven fans) then you can automate the Jar building very nicely, and also use it outside of Eclipse (e.g., in an automated build environment). All you need to do is copy the files from your src, jsp, foobar and resources locations into a build staging folder, then Jar the resulting files using ANT's Jar task.
<target name="makejar" depends="compile, copyfiles">
<jar destfile="${jars.dir}/myjarfile.jar" index="true" basedir="${build.dir}" />
</target>
One thing I look down on is including non-source (except package.html files for Javadoc) within the src folder. If you feel you have to do this to achieve something, then you are doing it wrong.

Resources