云下的天空

          堅持 隨心而動 走自己的路

           

          AS中的Parent,ParentDocument,ParentApplication屬性


          原文鏈接:

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


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

          1. Parent:指包含此組件的父級容器對象(DisplayObjectContainer), 這里的包含是詞義上(Lexical)的包含. DisplayObjectContainer是一個抽象類, 是所有能夠包含子對象(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)鍵點是 什么是文檔對象? 文檔對象是頂層的Flex程序, MXML組件或者AS組件, 其類型必須是UIComponent, 所以, Document一般指代的是自定義組件的根結(jié)點或者程序的Application結(jié)點. 它和Parent的區(qū)別是在于, 它不是詞義上的父對象, 而是父文檔. 例如我們自定義一個繼承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 對象. 通常一個Flex程序包含在標簽中, 但這個程序又可能會作為一個模塊(moduler)存在于更大的程序中. ParentApplication則指向了包含此組件的”最近”的Application 對象, 當(dāng)存在更上一層的Application 對象時, 可以通過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 天空布藍 閱讀(2591) 評論(0)  編輯  收藏 所屬分類: Flex4

          導(dǎo)航

          統(tǒng)計

          常用鏈接

          留言簿

          隨筆分類

          隨筆檔案

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

          搜索

          •  

          最新評論

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

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 怀来县| 曲靖市| 彰武县| 永寿县| 无棣县| 洛浦县| 余姚市| 平阳县| 福鼎市| 阜阳市| 灌南县| 靖宇县| 长子县| 华蓥市| 福鼎市| 贺兰县| 永定县| 西安市| 长子县| 荆州市| 略阳县| 无为县| 陇南市| 肇源县| 湾仔区| 航空| 高邮市| 永福县| 昭平县| 盐津县| 镇雄县| 鄯善县| 九寨沟县| 河津市| 海宁市| 通许县| 新巴尔虎右旗| 霍邱县| 都兰县| 筠连县| 怀宁县|