这是我的问题,相当明显:[img at bottom]
正如您所看到的,问题是文本(高度和宽度)与我通过Flex 4中的Main.mxml文件设置的组件(Spark TextArea)的高度和宽度完全不同。这是这让我很生气,因为没有人能告诉我为什么会这样,或者如何解决它。当人们在服务器中发送消息时,文本会动态添加到TextArea,因此值为Commit行。
我不明白这一点,因为我知道这不是我的fx:Script的错。我知道这一点,因为当我切换到Adobe Flex Builder 4的Design选项卡时;线条和屏幕截图一样混乱。
我在这个问题上一直在撕扯我的头发(比喻),请帮我解答。
<!-- State: interface -->
<s:TextArea id="incomingMessages" includeIn="interface"
heightInLines="{NaN}" widthInChars="{NaN}"
y="10" x="9" minWidth="426" minHeight="442"
text="Connected to Chat Paradise v5.00a, By CharlesBroughton."
valueCommit="incomingMessages_valueCommitHandler(event)"/>
<!-- Toolbar -->
<s:HGroup includeIn="interface" x="10" y="460" width="363" height="22">
<mx:ColorPicker id="tintColor" selectedColor="#FFFFFF" includeIn="interface"/>
<s:Label id="curname" height="22" width="100" text="<user>" fontSize="16" includeIn="interface"/>
<s:CheckBox label="AutoScroll" id="scrollToggle" selected="true"/>
<s:Button id="clearButton" width="60" height="22" label="Clear" click="incomingMessages.text = "";"/>
</s:HGroup>
<!-- end Toolbar -->
<s:Button id="sendMessage" width="60" height="22" label="SEND" includeIn="interface" x="375" y="460"/>
<s:TextArea id="outgoingMessages" x="10" y="480" maxChars="2048" editable="true" width="425" height="50" includeIn="interface" skinClass="graphite.skins.TextAreaSkin"/>
<s:List id="userlist" x="443" y="10" width="128" height="488" includeIn="interface" itemRenderer="userlistRenderer"/>
<s:ComboBox includeIn="interface" x="444" y="506" width="127" id="songs" selectedIndex="0"/>
<!-- end State: interface -->
如果你关心的话,这是FX:SCRIPT for incomingMessages_valueCommitHandler(event):
protected function incomingMessages_valueCommitHandler(event:FlexEvent):void
{
if (scrollToggle.selected)
incomingMessages.textDisplay.verticalScrollPosition = incomingMessages.textDisplay.maxHeight;
}
我不允许发布图片[少于10名],所以这里有一个链接:Image Link 已编辑以包含所要求的周围代码。你们似乎都不明白的是文本框占用了我设置的大小,但文本框内的文本只占用了100px宽和高的文本框总面积,请检查图片链接。
好的,我们发现了问题,graphite.styles.TextAreaSkin ...... 什么是吸烟?
<s:Scroller id="scroller" left="0" top="0" right="0" bottom="0" minViewportInset="1" measuredSizeIncludesScrollBars="false">
<s:RichEditableText id="textDisplay"
lineBreak="toFit"
textAlign="left"
selectable="true"
verticalAlign="top"
paddingBottom="4"
paddingTop="4"
paddingLeft="4"
paddingRight="4"
height="125"
width="125"
maxWidth="125"
maxHeight="125"/>
</s:Scroller>
答案 0 :(得分:1)
TextArea的父级是什么类型的组件?在不知道任何周围的mxml的情况下,您可能希望将宽度和高度设置为100%。如果这不起作用,请发布更多的mxml,我们会尝试解决它。希望有所帮助。
答案 1 :(得分:1)
正如你所说,这是石墨textarea皮肤的一个问题。我为textarea创建了一个新的skinClass(基于石墨文本区域皮肤)。并用Spark文本区域替换了scroller和richeditabletext。并添加了textAlign =&#34; left&#34;。它开始工作正常。如果这有帮助,请告诉我。感谢。