Installing Falcon and FalconJX
To install the Falcon and FalconJX compilers, install the FlexJS SDK as described here.
Using Falcon to create SWFs
Falcon has almost all of the MXMLC compiler options. However it does not currently support font embedding. In addition, there are new compiler options that allow overriding of the classes used by the generated code for data binding, and for generating a different kind of output when compiling MXMLC.
Specifically:
Falcon (SWF Compiler) should support all MXMLC inputs from the regular Flex SDK except the "keep-generated-actionscript" option which I think it just ignores (Falcon does not generate ActionScript from MXML, it goes straight from MXML to ABC). I think there are some embedded font options that aren't supported either.
In addition, Falcon supports:
-compiler.mxml.children-as-data (true required for FlexJS MXMLC compilation). It changes the MXML code generation to be a data structure instead of many run-once methods.
-compiler.mxml.implicitImports. In FlexJS we change the set of classes you don't have to import in your MXML script blocks and event handlers.
-compiler.binding-value-change-event. The name of the event class the DataBinding subsystem uses for detecting change events
-compiler.binding-value-change-event-type. The name of the event in the event class.
-compiler.binding-event-handler-event This is used in code generation for [Bindable] vars
-compiler.binding-event-handler-class This is used in code generation for [Bindable] vars
-compiler.binding-event-handler-interface This is used in code generation for [Bindable] vars
-compiler.states-class This is used in code generation for states.
-compiler.states-instance-override-class This is used in code generation for states.
-compiler.states-property-override-class This is used in code generation for states.
-compiler.states-event-override-class This is used in code generation for states.
-compiler.states-style-override-class This is used in code generation for states.
-compiler.component-factory-class This is used in code generation for fx:Components.
-compiler.component-factory-interface This is used in code generation for fx:Components.
-compiler.proxy-base-class This is used in code generation for Proxy
-compiler.allow-subclass-overrides This does what it says.
-compiler.strict-xml
-use-flashbuilder-project-files <path to project>. This has the compiler use most of the settings that Flash Builder uses. You can use -fb as well.
-isExcludeNativeJSLibraries This removes the externs swcs from the library path and external library path. (A.H. I don't think we need this, but not sure.)
So usage is similar to MXMLC. There are .bat files for Windows and shell scripts for Mac and Linux in the bin folder of the FlexJS SDK.
Using FalconJX to Create HTML/JS/CSS
FalconJX produces the following Java executables:
- compc.jar = library compiler
- externc.jar = ExternC compiler
- jsc.jar = shared code between compc and mxmlc
- mxmlc.jar = application compiler
The three jars used for compiling are:
- mxmlc for standard application compilation
- compc for creating library SWCs
- externc for creating swcs from Google-style extern files
In practice, you would use one of the following script (executables) for cross-compiling code in the command line:
- asjsc - compiles AS app to JS with JS.swc
- asjscompc - compiles AS library to JS with JS.swc
- asnodec - compiles AS app to JS with JS.swc and Node.swc
- jquery = compiles AS app to JS with JS.swc and Jquery.swc
- compc - compiles AS library to JS with FlexJS framework
- mxmlc - compiles AS app to JS with FlexJS framework
- externc - runs ExternC compiler to compile externs JS files to AS.
Arguments
FalconJX supports all of the compiler options that Falcon does. In addition, there are new compiler options for dictating where to find the Google Closure Library code used by some of the generated code, and where to find other JS files to be used in the output.
These are the options that FalconJX adds to Falcon:
-targets Specify the output format(s). May contain multiple values, separated by commas. JSFlex,SWF is the default for mxmlc. JS is the default for asjsc. JSNode is the default for asnodec.
-source-map Generate a source map to allow JavaScript debuggers to display and add breakpoints to the original ActionScript and MXML.
-closure-lib Path to Google Closure Library. Defaults to a known place in the FlexJS SDK
-sdk-js-lib Path to other folder of JS files to resolve class dependencies
-external-js-lib Path to folder of externs JS files
-strict-publish Passes Strict option to Google Closure Compiler
-keep-asdoc Copies ASDoc into JSDoc
-remove-circulars Tries to eliminate goog.requires from output that causes GCC to error about circular dependencies
-skip-transpile When used with -debug=false, doesn't generate the bin/js-debug version so you can just pass what is in js-debug to GCC for optimization (in case you manually edited something in js-debug)
-js-compiler-option Other options to pass to GCC
-js-output-optimization Allowed options: skipFunctionCoercions skipAsCoercions These options cause the compiler to not generate calls to Language.is and Language.as.
-js-output-type (Deprecated) Options to change some aspects of the output. FLEXJS is the default. Also supported is JSC for "no-SWF" workflows, and NODE.
ExternC arguments
ExternC has different arguments than the main compiler:
-js-root Tells ExternC to generate JS instead of AS and place it in the specified folder
-as-root Tells ExternC to generate AS and place it in the specified folder
-class-to-function Name of JS classes to output as a Function
-external Files of externs
-external-externs Similar to -external-library-path for externs. Basically, a way to specify some types that are needed at compile time without including them in the final output.
-exclude (class, name) Name of method in class to skip
-field-exclude (class, field) Name of var in class to skip
-class-exclude (class) Name of class to skip
-named-module Not sure about this one either.
About js-root:
ExternC parses most JS, including some JS not already formatted as GCC Externs. Normally it outputs AS. But sometimes we want it to output true GCC Externs because otherwise GCC will complain. Eventually, ExternC could parse any JS and be used to generate Externs.