R – differences when compiling a project using flex builder and flex sdk

apache-flexcomparisoncompiler-constructionflexbuildersdk

The following code compiles fine in flex builder 3, but throws an error when compiled using the command line and flex sdk 3.3.

<?xml version="1.0" encoding="utf-8"?>
<ww:TestApplication
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:ww="*"
    layout="absolute"
    backgroundColor="#FFFFFF"
    >
    <mx:Label x="10" y="10" text="simple test"/>
</ww:TestApplication>

The error message is: Unable to locate specified base class 'TestApplication' for component class 'TestApplication'.

The problem only happens when I use the default package for my custom classes. If instead I use

xmlns:ww="somepackage.*"

and change my matching AS class accordingly, then it compiles fine using the sdk. Am I missing an argument when compiling or something? Are there differences when compiling a project using flex builder and flex sdk? If so, which ones?

Best Answer

The paths have to be explicitly defined using mxmlc or compc. Here is an explanation of the flags:

source-path is used to define the path to the source if it is not in the default:

mxmlc -source-path path1 path2 path3 c:/myFiles/app.mxml

library-path is used to define the path to libraries:

mxmlc -library-path [AIR SDK]/frameworks/libs/air/airframework.swc, ^ [AIR SDK]/frameworks/libs/air/airframework.swc, ^ -library-path [Flex SDK]/frameworks/libs/framework.swc ^ -- myApp.mxml

file-specs is used to define the mxml file:

mxmlc --strict=true --file-specs MyFirst.mxml

runtime-shared-libraries is used to define the RSL path:

mxmlc -external-library-path+=../lib/myLib.swc -runtime-shared-libraries=myrsl.swf -- myApp.mxml

References

Related Topic