1

I have a Spark Scroller within my View because I have a lot of content and require vertical scrolling. I current have some labels that get data from my dataProvider, and the strings are sometimes long. I'd like the label to be multiline, but because everything is currently in a Scroller that does both x and y scrolling, the label never uses the maxDisplayedLines property and stretches the entire viewport out to the required size.

<s:Scroller left="10" right="10" top="10" bottom="0">
 <s:Group>
  <s:VGroup>
   <s:HGroup>
    <s:Label text="Name: "/>
    <s:Label text="{data.name}"/>
   </s:HGroup>
   <s:HGroup>
    <s:Label text="Description: "/>
    <s:Label text="{data.description}" maxDisplayedLines="-1"/> // This pushes everything out, I want it to not expand the content horizontally beyond the width
   </s:HGroup>
   ...
  </s:VGroup>
 </s:Group>
</s:Scroller>

Any help is appreciated. Thanks.

robp
  • 58
  • 6

2 Answers2

2

Use horizontalScrollPolicy="off"

chchrist
  • 18,854
  • 11
  • 48
  • 82
  • I came across this property early on, but unfortunately it just disables the scrollbar, but still keeps the content too wide, and allows scrolling programmatically. – robp Dec 29 '10 at 16:48
2

You need to establish a width on your containers/components so it all measures properly. This worked for me:

<s:Scroller left="10" right="10" top="10" bottom="0">
 <s:Group width="100%">
  <s:VGroup width="100%">
   <s:HGroup width="100%">
    <s:Label text="Name: "/>
    <s:Label text="{data.name}"/>
   </s:HGroup>
   <s:HGroup width="100%">
    <s:Label text="Description: "/>
    <s:Label width="100%" text="{data.description}" maxDisplayedLines="-1"/> // This pushes everything out, I want it to not expand the content horizontally beyond the width
   </s:HGroup>
   ...
  </s:VGroup>
 </s:Group>
</s:Scroller>
Wade Mueller
  • 6,059
  • 17
  • 19
  • Thanks, that did it. I had the width's set on the Group, VGroup and HGroup before, but what did it was setting the width to 100% on the label that was running long. Once I had that one set, it started to work as I wanted. – robp Dec 29 '10 at 16:49