[Flex]Flex SDK 4(Gumbo)浅析ASDoc - ASDoc MXML应用篇

详细请看:http://s.k-zone.cn/asdoc3

上一篇文章,介绍了如何在AS文件里面写ASDoc文档。
本篇文章介绍在MXML中编写ASDoc文档。

单行注释:
<!--- asdoc comment -->

多行注释:
<!--- 
    /** 
     * Comment for my class 
     * which is implemented as mxml 
     */ 
--> 
<!--- 
    * Comment for my class 
    * which is implemented as mxml 
-->

例如:(例子摘自http://s.k-zone.cn/asdocmxml

<?xml version="1.0"?>
<!-- asdoc\MyVBoxID.mxml -->
<!--- 
    The class level comment for the component. 
    This tag supports all ASDoc tags, 
    and does not require a CDATA block.

    @see mx.container.VBox
-->
<mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:mx="library://ns.adobe.com/flex/halo" 
    xmlns:s="library://ns.adobe.com/flex/spark">
    <!--- 
        Comment for first button appears in the output.
     -->
    <s:Button id="myButton" label="This button has a comment"/>
    <s:Button id="myButton2" 
        label="Has id but no comment so appears in output"/>
    <!--- 
        Comment for button with no id is ignored by ASDoc. 
     --> 
    <s:Button label="This button has no id"/>
</mx:VBox>

同样在mxml里面的<fx:Script></fx:Script>里面也可以使用ASDoc Tags
    <fx:Script>
        <![CDATA[
            import flash.events.MouseEvent;
            /** 
             * For a method in an &lt;Script&gt; block,
             * same rules as in an AS file.
             *
             * @param eventObj The event object.
             */
            public function handleClickEvent(eventObj:MouseEvent):void {
                dispatchEvent(eventObj);
            }   
            /** 
             * For a property in an &lt;Script&gt; block,
             * same rules as in an AS file.
             */
            public var myString:String = new String();
        ]]>
    </fx:Script>

<fx:Declaration>

例如:
<fx:Declarations> 
    <!--- 
        Specifies the skin for the first button on the ButtonBar. 
        @default spark.skins.default.ButtonBarFirstButtonSkin 
    --> 
    <fx:Component id="firstButton"> 
        <s:ButtonBarButton skinClass="spark.skins.default.ButtonBarFirstButtonSkin" /> 
    </fx:Component> 
</fx:Declarations>

<fx:Metadata>

例如:
<fx:Metadata> 
<![CDATA[ 
/** 
* Defines the default style of selected text. 
*/ 
[Style(name="textSelectedColor",type="Number",format="Color",inherit="yes")] 
]]>
</fx:Metadata>

posted @ 2009-08-06 14:22  Kenshin.L  阅读(1057)  评论(0编辑  收藏  举报