-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Flex 3 with Java

Flex SDK is bundled with two command-line compiler tools—one for compiling component library SWC files and the other for compiling executable Shockwave Flash (SWF) files.
The SWC files are Flex component archive files that include compiled binaries and embedded assets of a component. The SWC files can be referenced by Flex application as the external library of component definition. You can think of SWC files as JAR files in Java. To read more about the SWC format, visit http://livedocs.adobe.com/flex/3/html/help.html?content=building_overview_5.html.
The SWF files are complied binaries of Flex application. Think of these files as executables of the Flex applications which are executed by Flash Player either inside the Internet browsers or standalone Flash Player. To read more about the SWF file, visit http://www.adobe.com/devnet/swf/.
You use the component compiler to generate SWC files from component source files and other asset files, such as images and stylesheets. The SWC files are more like the .jar
files in Java. They are typically used as library files in a Flex project.
This is the general compc
syntax:
compc -namespace http://www.mynamespace.com manifest.xml
-source-path .
-include-namespaces http://www.mynamespace.com
-include-classes com.mycomponents.Component1 com.mycomponents.Component2
-include-file icon.png mx/containers/icon.png
-output=bin/MyComponents.swc
Type the preceding command on a single line. It appears here on multiple lines for the sake of clarity.
You can use the -namespace
and -include-namespaces
options to include any number of components. This can keep the command line from being untidy.
The source-path
option includes the current directory in the source path. This is how compc
finds the various classes that are listed in the include-classes
option.
The output
option specifies the output location of the SWC file. In this case, compc
writes the MyComponents.swc
file to a folder named bin
.
The include-classes
option specifies the classes that you want to include in the SWC file. The compc
component compiler is typically used in Flex for creating an external components library that can be referenced into Flex application or for creating Runtime Share Libraries, and so on. This is different from the mxmlc
application compiler, which generates a Flex application executable.
You use the mxmlc
application compiler to compile your Flex application source into an SWF binary file. The SWF files are executables of the Flex application that are executed into Flash Player. You can use the SWC files generated by component compiler, that is compc
, when compiling MXML files. You typically use the library-path
option to specify which SWC files the application uses.
This is the general mxml
syntax:
mxmlc -library-path+=..../MyLibraries/bin/Main.mxml
The -library-path
option includes the SWC files from the MyLibraries/bin
folder for referencing any component referenced inside Main.mxml
. For example, if Main.mxml
is referencing any component which is part of the MyComponents.swc
file, then you will need to include MyComponents.swc
into the -library-path
option. This is similar to what you do by including JAR files in -classpath
while compiling the Java source.
Change the font size
Change margin width
Change background colour