tags:

views:

1228

answers:

5

We've been attempting to compile ASDocs against a Flex 3 Library Project. Our problem is that ASDocs refuses to recognize any custom mxml component that is both created and used within the library.

For example, if we have a custom mxml AdvancedButton control in our library, and we attempt to use it in another mxml class within the library, ASDocs compiler errors out on the parent class file, with "Error: Type was not found or was not a compile-time constant: AdvancedButton".

An error also occurs if we try to extend our custom component. So if our library contains AdvancedButton that extends Button, and ExtraAdvancedButton that extends AdvancedButton, ASDocs will be "Unable to locate specified base class 'AdvancedButton for component class 'ExtraAdvancedButton'".

On the other hand, if AdvancedButton is referenced from an external library, we don't get errors.

This doesn't seem to be an issue if the files are .as, not .mxml. In our case, however, we have nested degrafa based components.

Ideas would be hugely appreciated.

A: 

Are you using the -library-path parameter of asdoc?
But wait, u said u r not getting errors if its referenced from external library - so u r using the library path already, right?

Flex 3 ASDoc doesn't document mxml at all. So may be u shud get flex 4 sdk and try with the asdoc that comes with it.

Amarghosh
A: 

Hey,

I had the same problem recently. The trick for me was to add -source-path "src" to the asdoc compiler arguments.

Here is the asdoc command which worked for me:

c:\work\prg\Flex>"c:\Program Files\Adobe\Flex Builder 3 Plug-in\sdks\3.3.0\bin\asdoc.exe" -doc-sources "src" -main-title "PRG documentation" -output "c:\work\prg\Flex\docs" -source-path "c:\work\XmlMappingAS3\src" -source-path "assets\css" -source-path "c:\Program Files\Adobe\Flex Builder 3 Plug-in\sdks\3.3.0\frameworks\projects\framework\src" -source-path "c:\Program Files\Adobe\Flex Builder 3 Plug-in\sdks\3.3.0\frameworks\projects\rpc\src" -external-library-path "c:\work\commonLibraries\Flex\as3commons-reflect-1.0.0.swc" -external-library-path "c:\work\commonLibraries\Flex\Cairngorm.swc" -external-library-path "c:\work\commonLibraries\Flex\spring-actionscript.swc" -external-library-path "c:\work\commonLibraries\Flex\xpath-as3-1.0.0.swc" -external-library-path "c:\work\commonLibraries\Flex\as3corelib.swc" -external-library-path "c:\work\commonLibraries\Flex\as3reflect.swc" -source-path "src"

Also, a great help would be to use the FlashDevelop ActionScript Documentation Generator (that is, in fact, what I used). If you install FlashDevelop on a Windows environment into "c:\Program Files\FlashDevelop", the Documentation Generator is located at "c:\Program Files\FlashDevelop\Tools\asdocgen\ASDocGen.exe".

Good luck!

A: 

I am facing the same problem. I am using Flashdevelop but fail to get compile classes in my external SWC file. How can i make ASDoc detect those classes...of SWC

sanjeev kumar
+1  A: 

I spent a good couple of hours trying to generate ASDocs for my Flex project and kept getting errors relating to not being able to find base class x/y/z. In the end I found it was because I wasn't telling ASDoc the location of the Flex SWC files:

(For me) C:\Program Files\Adobe\Flex Builder 3 Plug-in\sdks\3.4.0\frameworks\libs

Include this path in an additional -library-path argument and you should find it stops any errors about not finding base classes.

This sounds similar to the original problem described above which is missing links to where these custom components sit. Make sure the base directory is included which contains these custom component .as files

Michael S
A: 

I have the same problem -- I take it no-one has found an answer yet?

The error I was getting is similar to the original poster's:

/Users/loc_admin/ContinuousIntegration/CruiseControl/projects/leadlaw/build.xml:40: The following error occurred while executing this line: /Users/loc_admin/ContinuousIntegration/CruiseControl/projects/components/build.xml:35: exec returned: 1

/Users/loc_admin/ContinuousIntegration/CruiseControl/projects/leadlaw/source/src/com/rockingmm/leadlaw/components/MapMarker.mxml(25): Error: Type was not found or was not a compile-time constant: Location. public var location:Location;

I am referencing libraries, which appears to work fine if it's only one level deep, but if I have code that references libraries that reference other libraries (and so on), it drops the ball.

What worked for me was adding additional source-path declarations for the respective library projects, as well as library-path for the Flex framework classes.

My ASDoc target looks like so in my build.xml:

<target name="cleanAsDoc" description="Clean ASDoc directory of old contents.">
    <echo>Cleaning code documentation...</echo>
    <delete dir="${basedir}/html_docs" failOnError="true" includeEmptyDirs="true" />
    <mkdir dir="${basedir}/html_docs" />
    <echo>Doc directory cleanded.</echo>
</target>
<target name="logAsDoc">
    <echo>Logging code documentation...</echo>
    <record name="${basedir}/html_docs/asdoc-log.txt" action="start" append="true" />
</target>
<target name="generateAsDoc" depends="cleanAsDoc,logAsDoc" description="Generate fresh ASDoc code documentation.">
    <echo>Creating code documentation...</echo>
    <exec executable="${basedir}/../../../FlexSDK4/bin/asdoc" failOnError="true">
        <arg line="-doc-sources ${basedir}/source/src/com" />
        <arg line="-library-path ${basedir}/../../../FlexSDK4/frameworks/libs" />
        <arg line="-source-path ${basedir}/../modestmaps/source/src" />
        <arg line="-source-path ${basedir}/../components/source/src" />
        <arg line="-source-path ${basedir}/source/src" />
        <arg line="-external-library-path ${basedir}/source/libs" />
        <arg line="-window-title 'LeadLaw API Documentation'" />
        <arg line="-main-title 'LeadLaw API Documentation'" />
        <arg line="-footer 'Copyright 2010 RRP Lead Law. All rights reserved.'" />
        <arg line="-output ${basedir}/html_docs" />
    </exec>
</target>

Hope this helps! ~Mike

Mike