Search code examples
apache-flexmxmlc

app fails to compile with mxmlc command-line but works with flash builder IDE


I have this flex app (it's a flex project created from flash builder), and it compiles fine when I build it from the IDE.

it fails to compile when I do it from command line through mxmlc.

I am invoking the mxmlc at the location "flash-builder-installation"\sdks\"flex-ver"\bin\

the mxml file is test.mxml

I don't have any dependency on any of custom swc file.

I am getting the following type errors when I compile it

Error: Type was not found or was not a compile-time constant: TouchEvent

Error: Type was not found or was not a compile-time constant: File.

Error: Type was not found or was not a compile-time constant: FileStream

could you please let me know what i am missing here ?

thanks,


Solution

  • It looks like you are compiling an AIR application. AIR applications are slightly different than regular Flex web applications. Instead of mxmlc you need to use amxmlc, which is the AIR compiler. It is located within the same path as mxmlc. This will automatically include the AIR SWC libraries.

    If you have no other configuration, you can use the simplest command line:

    flash-builder-installation"\sdks\"flex-ver"\bin\amxmlc myApp.mxml
    

    If you need help with syntax, try this page for starters: Air Compiler Help

    I realize that the reference says Flex 3, but the compiler and options are the same. To get help from the command line, try:

    flash-builder-installation"\sdks\"flex-ver"\bin\amxml --help