Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.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 如何在滚动条中显示具有动态大小的标签_Actionscript 3_Apache Flex_Scroller - Fatal编程技术网

Actionscript 3 如何在滚动条中显示具有动态大小的标签

Actionscript 3 如何在滚动条中显示具有动态大小的标签,actionscript-3,apache-flex,scroller,Actionscript 3,Apache Flex,Scroller,我的一个应用程序中的标签显示有问题 我有一个显示标签的视图。此标签的文本可以随时更新,并且此文本可以由一个单词组成,因为它可以是带有一些换行符的长文本 如果整个文本可以放在父视图中,我希望它垂直居中。 如果它太长,不适合,我想显示一个滚动条 所以我使用了一个滚动条: <s:Scroller left="5" top="50" right="5" bottom="5"> <s:Group> <s:Label id="description"

我的一个应用程序中的标签显示有问题

我有一个显示标签的视图。此标签的文本可以随时更新,并且此文本可以由一个单词组成,因为它可以是带有一些换行符的长文本

如果整个文本可以放在父视图中,我希望它垂直居中。 如果它太长,不适合,我想显示一个滚动条

所以我使用了一个
滚动条

<s:Scroller left="5" top="50" right="5" bottom="5">
    <s:Group> 
        <s:Label id="description" text="{hostComponent.description}"
                 width="100%" verticalCenter="0"/>
    </s:Group>        
</s:Scroller>

如果文本较短,则标签按预期居中,但当文本足够长,可以显示scollbar时,我看不到第一行(9)

如果我省略了
verticalCenter=“0”
,则长文本将显示良好,但短文本不再垂直居中

有人对我的问题有解释和/或解决方案吗?

尝试使用HGroup:

<s:Scroller id="scroller" left="5" top="50" right="5" bottom="5">
    <s:HGroup verticalAlign="middle" width="100%" height="100%"> 
        <s:Label id="description" text="{hostComponent.description}"
                 width="100%"/>
    </s:HGroup>        
</s:Scroller>

尝试使用HGroup:

<s:Scroller id="scroller" left="5" top="50" right="5" bottom="5">
    <s:HGroup verticalAlign="middle" width="100%" height="100%"> 
        <s:Label id="description" text="{hostComponent.description}"
                 width="100%"/>
    </s:HGroup>        
</s:Scroller>