Search code examples
actionscript-3apache-flexswc

Why do my SWC libraries not code hint?


I recently took much of my reusable code and compiled them into SWCs for organization and ease-of-use purposes. Since doing so, none of my documentation has appeared in the code hints that Flash Builder provides. I have searched through project settings and I have been unable to find a setting for such a feature, and I am at a loss as to why it doesn't work anymore.

I compiled the SWCs using Flash Builder's Build Automatically functionality. I have not tried compiling with ANT yet, but will probably try the next time I build. asdocs was able to compile full documentation for all of my libraries with relative ease and the code hinting works if I use the raw AS files themselves, so I do not believe it has anything to do with the way I was writing the documentation. Example:

/**
 * <p>Batch adds variables from a generic object using name-value pairs</p>
 * @param variables A generic <code>Object</code> that contains name-value 
 * pairs that will be used as the arguments of the REST request
 */
public function addVariables( variables:Object ):void {}

Any idea why the code hinting no longer works?


Solution

  • Flash Builder uses ASDocs, which are embedded inside the SWC, to provide code hints - unfortunately, FB doesnt include the docs when it builds a SWC.

    However, it can be done 'manually' with ANT:

    <target name="insertASDocs">
        <zip destfile="PATH_TO_YOUR_SWC" update="true">
            <zipfileset dir="ASDOCS_FOLDER/tempdita" prefix="docs">
                <include name="*.*"/>
                <exclude name="ASDoc_Config.xml"/>
                <exclude name="overviews.xml"/>
            </zipfileset>
        </zip>
    </target>
    

    PATH_TO_YOUR_SWC is the relative path and swc name (eg: myFolder/mySwc.swc). ASDOCS_FOLDER is the folder where your generated docs are stored.

    The ANT script just adds the ASDocs to the SWC - after this, code hints should appear.

    Update:

    Forgot to mention that you need to set keep-xml to true when generating the docs (if inserting them into a swc):

    <asdoc keep-xml="true" ...