Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I build my Flex library from source on the command line so that I can RSL it?

What the question says: I want to use compc (either command-line or ant) to build a .swc from some actionscript and mxml code. Right now, the command I have is this:

# compile src to .swc
FLEX_HOME="${FLEX_HOME:?'FLEX_HOME must be set'}"
PROJECT_DIR=$(unset CDPATH; cd `dirname $0`/..; pwd)
COMPC="${FLEX_HOME}/bin/compc"

"$COMPC" \
 -source-path $PROJECT_DIR/src \
 -include-sources $PROJECT_DIR/src \
 -compiler.library-path "$FLEX_HOME/frameworks/libs" "$PROJECT_DIR/libs" "$HOME/projects/advanis/flex_libs/libs" \
 -output $PROJECT_DIR/bin/myLibrary.swc

However, when I build using this, the .swc catalog.xml file has, in addition to the classes in $PROJECT_DIR/src, the .swc file has classes from the dependent libraries and from the framework itself. I know that it's possible not to do this, since (for example) the Cairngorm library depends on the flash Event object, but that object is not in the .swc's library.swf file anywhere, or I'm fairly sure of it at any rate.

If it helps, here is my complete scenario, and maybe somebody can tell me why I'm going about it the wrong way:

I have a Flash Builder 4 Flash Application project that depends on:

  • The v3.4.1 SDK
  • FlexUnit 4, which I have as a pair of .swc files and would like to RSL:
    • FlexUnit4_1.0.swc
    • flexunitextended.swc
  • Cairngorm 2.2.1, as an SWC which I would like to RSL
  • mock-as3, which I have only as source, and would like to build using the above instructions to create a useable library
  • hamcrest-as3, which I have both as source and binary, and would like to build using the above instructions to create a useable library

When I set up the FlexUnit, Cairngorm, mock-as3, and hamcrest-as3 libraries as RSL libraries, with the .swf location set to something that exists, I get a runtime failure:

VerifyError: Error #1014: Class IMXMLObject could not be found.

This may be a consequence of the order of the libraries, the extra crap built into the mock-as3 library, or something else. The RSL swf files are optimized, if that makes a difference, using this command:

optimizer -keep-as3-metadata="Bindable,Managed,ChangeEvent,NonCommittingChangeEvent,Transient" \
    -input library.swf \
    -output $swf_file

Anyway, this is a bit scattered, but the gist of it is this: How on earth do I assemble third-party .swc files, third-party .swf files, third-party source packages, and my project into a working application?

like image 656
Chris R Avatar asked Dec 30 '25 15:12

Chris R


1 Answers

The "compiler.library-path" parameter causes those libraries to be linked in to the output SWF / SWC. To keep libraries from being linked in use the "compiler.external-library-path" parameter instead. But then make sure that dependencies are linked into your final application SWF or loaded some other way (like an RSL).

like image 174
James Ward Avatar answered Jan 01 '26 23:01

James Ward



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!