一个文本区域的初始高度远远大于内容,我不能找到一种方法使它总是相同的高度文本内容:
<mx:TextArea id="textarea" borderStyle="solid" width="100%" wordWrap="true" selectable="false" backgroundAlpha="0" focusAlpha="0" text="this is a little test" />
给出了一个与框比需要高多了。
这也给一个unintential问题如果你有在内容的链接,链接鼠标移至离链接时触发。
<mx:Script>
<![CDATA[
public function onInit():void
{
var style:StyleSheet = new StyleSheet();
var aLink:Object = new Object();
aLink.color = "#0000FF";
var aHover:Object = new Object();
aHover.color = "#00FF00";
aHover.textDecoration = "underline";
style.setStyle( "a:hover", aHover );
style.setStyle( "a:link", aLink );
textarea.styleSheet = style;
}
]]>
</mx:Script>
<mx:TextArea id="textarea" width="100%" wordWrap="true" borderStyle="solid" selectable="false" backgroundAlpha="0" focusAlpha="0" >
<mx:htmlText>
<![CDATA[<a href= event:http://www.adobe.com >Navigate to Adobe.com.</a> this is testing nothing at all really]]>
</mx:htmlText>
</mx:TextArea>
文本组件不受这个,但是我不能将样式表附加到一个文本组件。
希望有人可以帮助你。还是有其他一些组件可以使用,我可以添加一个样式表程式化锚标记。
我发现这个重写的文本区域。源和如果我覆盖和删除“2 x”乘数几乎工作但不幸的是这意味着内容并不变大,当它需要和垂直滚动相反,所以它几乎有:
override protected function measure():void
{
super.measure();
measuredMinWidth = DEFAULT_MEASURED_MIN_WIDTH;
measuredWidth = DEFAULT_MEASURED_WIDTH;
// TextArea is minimum of two lines of text
measuredMinHeight = measuredHeight = 2 * DEFAULT_MEASURED_MIN_HEIGHT;
}