云下的天空

          堅(jiān)持 隨心而動(dòng) 走自己的路

           

          AS中的Parent,ParentDocument,ParentApplication屬性


          原文鏈接:

          http://blog.shinysky.com/2010/02/as-parent-parentdocument-parentapplication/


          Flex中的組件(Component)有三個(gè)屬性, 通常用來引用上級的對象, 它們是 Parent, ParentDocument, ParentApplication.

          1. Parent:指包含此組件的父級容器對象(DisplayObjectContainer), 這里的包含是詞義上(Lexical)的包含. DisplayObjectContainer是一個(gè)抽象類, 是所有能夠包含子對象(child objects)的父類.

          The DisplayObjectContainer class is an abstract base class for all objects that can contain child objects. It cannot be instantiated directly; calling the new DisplayObjectContainer() constructor throws an ArgumentError exception.

          Inheritance: UIComponent-> FlexSprite-> Sprite-> DisplayObjectContainer-> InteractiveObject-> DisplayObject-> EventDispatcher-> Object



          2. ParentDocument:指向包含此組件的父文檔對象. 這里關(guān)鍵點(diǎn)是 什么是文檔對象? 文檔對象是頂層的Flex程序, MXML組件或者AS組件, 其類型必須是UIComponent, 所以, Document一般指代的是自定義組件的根結(jié)點(diǎn)或者程序的Application結(jié)點(diǎn). 它和Parent的區(qū)別是在于, 它不是詞義上的父對象, 而是父文檔. 例如我們自定義一個(gè)繼承Panel的MXML組件, FormItem的Parent是Form, 而FormItem 和Form 的ParentDocument則都是Panel.

          1<s:Panel>
          2  <mx:Form width="100%" height="100%">
          3    <mx:FormItem />
          4  </mx:Form>
          5</s:Panel>

          A reference to the parent document object for this UIComponent. A document object is a UIComponent at the top of the hierarchy of a Flex application, MXML component, or AS component. For the Application object, the parentDocument property is null. This property is useful in MXML scripts to go up a level in the chain of document objects. It can be used to walk this chain using parentDocument.parentDocument, and so on. It is typed as Object so that authors can access properties and methods on ancestor document objects without casting.



          3. ParentApplication:指向包含此組件的 Application 對象. 通常一個(gè)Flex程序包含在標(biāo)簽中, 但這個(gè)程序又可能會(huì)作為一個(gè)模塊(moduler)存在于更大的程序中. ParentApplication則指向了包含此組件的”最近”的Application 對象, 當(dāng)存在更上一層的Application 對象時(shí), 可以通過ParentApplication.ParentApplication這樣的鏈接來存取.

          A reference to the Application object that contains this UIComponent instance. This Application object might exist in a SWFLoader control in another Application, and so on, creating a chain of Application objects that can be walked using parentApplication. The parentApplication property of an Application is never itself; it is either the Application into which it was loaded or null (for the top-level Application).

          posted on 2011-06-04 11:07 天空布藍(lán) 閱讀(2593) 評論(0)  編輯  收藏 所屬分類: Flex4

          導(dǎo)航

          統(tǒng)計(jì)

          常用鏈接

          留言簿

          隨筆分類

          隨筆檔案

          Flex學(xué)習(xí)鏈接

          搜索

          •  

          最新評論

          • 1.?re: tomcat7的配置
          • 新建變量名: TOMCAT_HOME 應(yīng)該為CATALINA_HOME
          • --houkai
          • 2.?re: tomcat7的配置
          • 確實(shí)是的@寒澈
          • --houkai
          • 3.?re: tomcat7的配置
          • @ftp123
            你娘里個(gè)大雪碧 里面會(huì)有common這個(gè)文件夾嗎 不知道還尼瑪在這瞎比比 純尼瑪誤導(dǎo)人 我最惡心的就是這樣沒事裝逼的人 艸
          • --cao
          • 4.?re: tomcat7的配置
          • 從哪抄來的,是抄的,你也說聲啊,要不自己測試下也可以,害人測試半天。
          • --ftp123
          • 5.?re: tomcat7的配置
          • %TOMCAT_HOME%\common\lib 從tomcat6.0開始已經(jīng)沒有common文件夾了,直接用\lib,害我找了半天common文件夾啊,趕快改過來吧
          • --寒澈

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 榆林市| 罗平县| 九台市| 浦县| 滕州市| 安平县| 临湘市| 伊宁市| 兴和县| 辽阳县| 京山县| 临武县| 鹰潭市| 奉节县| 泾源县| 陕西省| 西盟| 渝中区| 水富县| 南召县| 凌海市| 山丹县| 红安县| 循化| 剑阁县| 浦北县| 兰州市| 大连市| 桃江县| 鄯善县| 阿巴嘎旗| 囊谦县| 宁海县| 溆浦县| 库车县| 布尔津县| 抚顺县| 辽宁省| 枣强县| 新和县| 麻江县|