Adobe Air vertical scroll for rich text
I have a rich text component with large amount of text. How to add vertical scrollbar to it?
I tried:
<mx:Canvas width="100%" height="100%" verticalScrollBar="vsb">
<s:RichText id="text" width="100%" height="100%" maxDisplayedLines="-1"/>
</mx:Canvas>
<s:VScrollBar id="vsb" height="100%"/>
But it get error: Initializer for 'verticalScrollBar': values of type mx.controls.scrollClasses.ScrollBar cannot be represented i开发者_高级运维n text.
Reading the docs on RichText, I see this:
For performance reasons, it does not support scrolling, selection, editing, clickable hyperlinks, or images loaded from URLs. If you need those capabilities, please see the RichEditableText class.
So, going with a RichEditableText (and setting its editable
property to false
, this works for me with FlashBuilder 4.5. Note: I set the Scroller height to 200 and added lots of text to force a scrollbar to appear)
<mx:Canvas width="100%" height="100%">
<s:Scroller width="100%" height="200">
<s:RichEditableText percentWidth="100" percentHeight="100" editable="false">
<!-- add lots of text here to introduce a scrollbar -->
</s:RichEditableText>
</s:Scroller>
</mx:Canvas>
精彩评论