Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 Flex id内容组查询_Actionscript 3_Flash_Apache Flex_Actionscript_Flex4 - Fatal编程技术网

Actionscript 3 Flex id内容组查询

Actionscript 3 Flex id内容组查询,actionscript-3,flash,apache-flex,actionscript,flex4,Actionscript 3,Flash,Apache Flex,Actionscript,Flex4,我正在学习柔韧性并练习皮肤。所以,我有一个疑问: 我已经编写了一个名为: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="

我正在学习柔韧性并练习皮肤。所以,我有一个疑问:

我已经编写了一个名为: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>

[主机组件(“spark.components.Application”)]
我的怀疑: 当我删除s:Group id=“contentGroup”时,我无法看到我的应用程序中的任何内容,那么为什么需要这个“contentGroup”id呢

其中预先指定了此id。?很抱歉,如果这是一个noob查询,但我很想知道。我甚至试图检查源代码,但我没有找到它,有人能告诉我它在哪里指定的,我的内容如何呈现只有在使用此contentGroup id。。。?(我的意思是,它内部是如何工作的?)


等待您的回复

可蒙皮火花组件指定由id标识的“蒙皮零件”

您正在蒙皮的应用程序组件定义了两个蒙皮部分—contentGroup和controlBarGroup,您可以在此处的文档中看到:


应用程序类使用contentGroup外观部分(如果已添加到外观中)来布局内容。蒙皮零件可以是必需的,也可以不是。contentGroup部分不是必需的,因此当您忽略它时,内容就没有显示出来。

同意!但是使用我们的contentGroup它是如何显示的呢?要明确的是,它在内部是如何工作的?SkinnableComponent有一个partAdded方法。在该方法中,组件将检查添加了什么部件,并相应地使用它。在这种情况下,它将使用组来布局内容。SkinnableContainerGroup组件中的“addElement”函数及其派生函数将被覆盖,以将内容添加到“contentGroup”中。因此,如果您通过mxml添加某些内容,编译器会将其写入组件“mxmlContent”数组,然后在运行时通过“addElement”将其添加到显示列表中。这可能是一个简短的解释,但大致就是它的工作原理。请注意,在对应用程序进行蒙皮时,您会遇到很多
contentGroup
,因为从
SkinnableContainer
扩展而来的所有组件都具有特定的skinpart(即几乎所有可以容纳其他组件的组件)。