[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>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章