2011-03-25 31 views
2

ASDoc可以在您的評論中包含示例MXML代碼嗎?是否可以在ASDoc中包含示例mxml?

/** 
* @example This should be example code 
* <listing version="3.0"> 
* <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" ...> 
* </listing> 
*/ 

這產生一個空的示例代碼塊。

回答

4

是的,但是當瀏覽器看到大於標誌的開啓和關閉時,它會嘗試將其解釋爲HTML標籤。所以,逃避他們:

/** 
* @example This should be example code 
* &lt;listing version="3.0"&gt; 
* &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" ...&gt; 
* &lt;/listing&gt; 
*/ 
+0

啊我試圖包裝在CDATA中沒有想到要試試這個,不知道includeExample文檔。 – shaunhusain 2011-03-25 20:24:33

1

是但如果你想上運行的ASDoc文件是一個MXML文件:

http://opensource.adobe.com/wiki/display/flexsdk/ASDoc+in+MXML

複製從ViewStack.as整個註釋塊從框架內爲包括示例MXML文件作爲一個例子塊:

/** 
* A ViewStack navigator container consists of a collection of child 
* containers stacked on top of each other, where only one child 
* at a time is visible. 
* When a different child container is selected, it seems to replace 
* the old one because it appears in the same location. 
* However, the old child container still exists; it is just invisible. 
* 
* <p>A ViewStack container does not provide a user interface 
* for selecting which child container is currently visible. 
* Typically, you set its <code>selectedIndex</code> or 
* <code>selectedChild</code> property in ActionScript in response to 
* some user action. Alternately, you can associate a LinkBar, TabBar or ToggleButtonBar 
* container with a ViewStack container to provide a navigation interface. 
* To do so, specify the ViewStack container as the value of the 
* <code>dataProvider</code> property of the LinkBar, TabBar or 
* ToggleButtonBar container.</p> 
* 
* <p>You might decide to use a more complex navigator container than the 
* ViewStack container, such as a TabNavigator container or Accordion 
* container. In addition to having a collection of child containers, 
* these containers provide their own user interface controls 
* for navigating between their children.</p> 
* 
* <p>When you change the currently visible child container, 
* you can use the <code>hideEffect</code> property of the container being 
* hidden and the <code>showEffect</code> property of the newly visible child 
* container to apply an effect to the child containers. 
* The ViewStack container waits for the <code>hideEffect</code> of the child 
* container being hidden to complete before it reveals the new child 
* container. 
* You can interrupt a currently playing effect if you change the 
* <code>selectedIndex</code> property of the ViewStack container 
* while an effect is playing.</p> 
* 
* <p>The ViewStack container has the following default sizing characteristics:</p> 
*  <table class="innertable"> 
*  <tr> 
*   <th>Characteristic</th> 
*   <th>Description</th> 
*  </tr> 
*  <tr> 
*   <td>Default size</td> 
*   <td>The width and height of the initial active child.</td> 
*  </tr> 
*  <tr> 
*   <td>Container resizing rules</td> 
*   <td>By default, ViewStack containers are sized only once to fit the size of the 
*    first child container. They do not resize when you navigate to other child 
*    containers. To force ViewStack containers to resize when you navigate 
*    to a different child container, set the resizeToContent property to true.</td> 
*  </tr> 
*  <tr> 
*   <td>Child sizing rules</td> 
*   <td>Children are sized to their default size. If the child is larger than the ViewStack 
*    container, it is clipped. If the child is smaller than the ViewStack container, 
*    it is aligned to the upper-left corner of the ViewStack container.</td> 
*  </tr> 
*  <tr> 
*   <td>Default padding</td> 
*   <td>0 pixels for top, bottom, left, and right values.</td> 
*  </tr> 
*  </table> 
* 
* @mxml 
* 
* <p>The <code>&lt;mx:ViewStack&gt;</code> tag inherits the 
* tag attributes of its superclass, with the exception of scrolling-related 
* attributes, and adds the following tag attributes:</p> 
* 
* <pre> 
* &lt;mx:ViewStack 
* <b>Properties</b> 
* historyManagementEnabled="false|true" 
* resizeToContent="false|true" 
* selectedIndex="0" 
*  
* <b>Styles</b> 
* horizontalGap="8" 
* paddingBottom="0" 
* paddingTop="0" 
* verticalGap="6" 
*  
* <b>Events</b> 
* change="<i>No default</i>" 
* &gt; 
*  ... 
*  <i>child tags</i> 
*  ... 
* &lt;/mx:ViewStack&gt; 
* </pre> 
* 
* @includeExample examples/ViewStackExample.mxml 
* 
* @see mx.controls.LinkBar 
* @see mx.managers.HistoryManager 
* @see mx.managers.LayoutManager 
*/ 

在有關的ASDoc文檔他們提到註釋文本應先於任何標籤和任何標籤之後應該考慮的標籤的參數的一部分,唯一的例外貝因g @private。

另外據我所知,並沒有任何成功的嘗試,你不能只是把內聯的例子,因爲你的帖子無法迴避。

+0

我認爲includeExample標籤是不同於他要求做的。我認爲該標籤與生成的ASDoc底部顯示的「示例」部分相關。我想他只是想展示MXML;類似於您複製的樣本的「前」部分中的內容。另外,includeExample標籤上是否有任何文檔? – JeffryHouser 2011-03-25 20:19:24

+0

是的,我只是在類的開頭的ASDoc塊底部顯示了@example標籤。解決的辦法是逃避大於和小於標誌,我應該認識到這一點。 (DOH)。 – trashcanman 2011-03-25 20:49:40

+0

很高興你們知道了我會盡力在腦海中注意到這一點,以供將來參考。 – shaunhusain 2011-03-25 20:58:09

相關問題