Flex id contentGroup query

帅比萌擦擦* 提交于 2019-12-11 19:22:26

问题


iam learning Flex and practising skins. So, i just had one doubt:

I have written one custom skin named : ApplicationContainerSkin.mxml

<?xml version="1.0" encoding="utf-8"?>
<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" 
             xmlns:s="library://ns.adobe.com/flex/spark" 
             xmlns:mx="library://ns.adobe.com/flex/mx">

    <s:states>
        <s:State name="normal" />
        <s:State name="disabled" />
    </s:states>


    <fx:Metadata>
        [HostComponent("spark.components.Application")]
    </fx:Metadata>


    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <s:Group horizontalCenter="0" verticalCenter="0">

        <s:Rect left="0" right="0" top="0" bottom="0"
                radiusX="10" radiusY="10">
            <s:fill>
                <s:SolidColor color="#CCCCCC" />
            </s:fill>
        </s:Rect>


        <s:Group id="contentGroup"
                 left="30" right="30" top="30" bottom="30">

        </s:Group>

    </s:Group>

</s:SparkSkin>

My Doubt: When I removed s:Group id="contentGroup" , iam unable to see any content inside my application, so why is this 'contentGroup' id necessary?

where this id predefinedly specified.? sorry if its a noob query, but iam eager to knew it.I even tried to check the source code, but I didnt found it, Could anyone tell me where it specified and how does my content render only after using this contentGroup id...? ( I mean, how it internally works? )

Awaiting your responses!


回答1:


Skinnable Spark components specify "skin parts," identified by the id.

The Application component, which you are skinning, defines 2 skin parts - contentGroup and controlBarGroup, as you can see in the documentation here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/spark/components/Application.html#SkinPartSummary

The Application class uses the contentGroup skin part (if it has been added in the skin) to lay out the content. Skin parts can either be required or not. The contentGroup part is not required, and therefore when you left it out, the content just did not display.



来源:https://stackoverflow.com/questions/18181342/flex-id-contentgroup-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!