Apache flex 如何清除组的显式宽度和高度

Apache flex 如何清除组的显式宽度和高度,apache-flex,flex4,flex-spark,Apache Flex,Flex4,Flex Spark,我有一个组,它的大小与它包含的内容相符,但要使用Tweener执行转换,我必须设置宽度和高度属性。动画完成后,如何清除显式的宽度和高度属性,以便组返回到基于其内容的大小调整 之前: <s:Group ><content.../></s:Group> 在tween之后,组有效地设置为500x500,就好像它是这样的: <s:Group width="500" height="500" ><content /></s:Group&g

我有一个组,它的大小与它包含的内容相符,但要使用Tweener执行转换,我必须设置宽度和高度属性。动画完成后,如何清除显式的宽度和高度属性,以便组返回到基于其内容的大小调整

之前:

<s:Group ><content.../></s:Group>
在tween之后,组有效地设置为500x500,就好像它是这样的:

<s:Group width="500" height="500" ><content /></s:Group>

我想让它回到这一点:

<s:Group ><content /></s:Group>

更新
使用Flextras的解决方案测试代码:

<fx:Script>
    <![CDATA[
        protected function button1_clickHandler(event:MouseEvent):void
        {
            var w:Object = myGroup.width;
            var h:Object = myGroup.height;

            if (myGroup.width!=300) {
                myGroup.width = 300;
                myGroup.height = 300;
            }
            else {
                myGroup.width = NaN;
                myGroup.height = NaN;

                w = myGroup.width; // NaN
                h = myGroup.height; // NaN

                //myGroup.validateNow()
                if (myGroup.parent is IInvalidating) {
                    IInvalidating(myGroup.parent).validateNow();
                }

                w = myGroup.width; // 600
                h = myGroup.height; // 100
            }


        }
    ]]>
</fx:Script>

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

<s:Group id="myGroup" minHeight="0" minWidth="0" clipAndEnableScrolling="true">     
    <s:Button width="600" height="100" label="here is a button" click="button1_clickHandler(event)"/>
</s:Group>


将高度和宽度设置为NaN;这将有效地告诉Flex框架“我不知道这个值是什么”,然后在组件下次呈现自身时执行measure()事件;使其更新measuredHeight和measuredWidth属性;父容器将依次使用它来调整组的大小

将高度和宽度设置为NaN或Null?然后invalidateSize()强制组重新计算?我没有尝试过。那就行了。:)如果你想得到分数,请添加答案。
<fx:Script>
    <![CDATA[
        protected function button1_clickHandler(event:MouseEvent):void
        {
            var w:Object = myGroup.width;
            var h:Object = myGroup.height;

            if (myGroup.width!=300) {
                myGroup.width = 300;
                myGroup.height = 300;
            }
            else {
                myGroup.width = NaN;
                myGroup.height = NaN;

                w = myGroup.width; // NaN
                h = myGroup.height; // NaN

                //myGroup.validateNow()
                if (myGroup.parent is IInvalidating) {
                    IInvalidating(myGroup.parent).validateNow();
                }

                w = myGroup.width; // 600
                h = myGroup.height; // 100
            }


        }
    ]]>
</fx:Script>

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

<s:Group id="myGroup" minHeight="0" minWidth="0" clipAndEnableScrolling="true">     
    <s:Button width="600" height="100" label="here is a button" click="button1_clickHandler(event)"/>
</s:Group>