15 December 2008

Creating LiveDocs-style Documentation for Your Flex App

One powerful -- and hidden -- tool that ships with Flex Builder (and I think the SDK) is the ASDoc documentation utility, found here,
C:\Program Files\Adobe\Flex Builder 3\sdks\3.2.0\bin\ASDoc.exe

You need to use the special code comments (/** */ and <!--- -->), otherwise ASDoc will ignore them. So a sample code block looks like this,

* Boolean indicating visibility of the Submit button.
public function get SubmitVisible():Boolean {
return _submitVisible;

You can read more about ASDoc and its switches on the Adobe Using ASDoc page. When you're ready to generate your documentation, you call the ASDoc utility from the command prompt with some switches. The parameters ("switches") tell ASDoc what to parse and where to put the output, among other options. One quick way to see the options is to run asdoc -help at the command line. Here's one sample call to ASDoc,
asdoc -library-path C:\FlexProjects\MyApp\lib -source-path C:\FlexProjects\MyApp\src\ -doc-sources C:\FlexProjects\MyAp\sr\MyApp.mxml -output doc-folder 

The above call tells the ASDoc tool to
  • Use the SWC files (if any) in the lib folder; these are often used for third-party components.
  • Generate documentation for the MXML file. In my case, I had a lot of ActionScript in the MXML and wanted it pulled.
  • And place the output in a folder called doc-folder.

No comments: