Flex spark百分比高度不起作用

时间:2010-02-24 12:01:31

标签: flex

首先我知道有一个Spark VolumeBar组件但是,对于设计要求我不能使用它..

我正在尝试创建自定义组件,但高度没有响应,

[更新]

这是我称之为

<components:VolumeSlider steps="4" height="100" />

问题是音量滑块完美适应,但我的自定义项目组件没有。

<s:HGroup width="100%" height="100%" maxHeight="{height}" >
        <s:VGroup width="100%" height="100%" paddingBottom="20" paddingTop="20">
            <s:VSlider id="slider" width="100%" height="100%" maximum="{_steps-1}" />
        </s:VGroup>

        <s:VGroup id="items" width="100%" height="100%" />
    </s:HGroup>



<fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;

            [Bindable]
            private var _steps:uint = 10;

            public function set steps( value:uint ):void
            {
                _steps = value;

                if ( items != null && items.numChildren != 0 )
                {
                    items.removeAllElements();
                }

                create();
            }

            private function create():void
            {
                for ( var i:uint = 0; i < _steps; ++i )
                {
                    var item:VolumeSliderItem = new VolumeSliderItem();
                    item.percentHeight = item.percentWidth = 100;
                    if ( items != null )items.addElement(item );
                }
            }



        ]]>
    </fx:Script>

其中VolumeSliderItem是一个spark按钮

1 个答案:

答案 0 :(得分:0)

我没有看到任何对create()的调用。我在Application标签上添加了'creationComplete =“create()”',然后它创建了10个滑块到VGroup,ID为'items'。这就是你要找的东西吗?

相关问题