我是使用flex的新手。我有一个linkButton,当我将鼠标悬停在上面时,我需要它下划线。我认为它可以通过setstyle()完成,但我不知道语法及其工作原理。我环顾四周,但它发现了与此相关的任何有用的东西。
非常感谢任何帮助。
答案 0 :(得分:1)
使用的语法是:
buttonObject.setStyle("property", "value");
一个完整的例子:
<fx:Script>
<![CDATA[
import mx.controls.Alert;
protected function linkbutton1_clickHandler(event:MouseEvent):void
{
Alert.show('LinkButton selected!');
}
protected function linkbutton1_mouseOverHandler(event:MouseEvent):void
{
btn.setStyle("textDecoration", "underline");
}
protected function linkbutton1_mouseOutHandler(event:MouseEvent):void
{
btn.setStyle("textDecoration", "none");
}
]]>
</fx:Script>
<mx:LinkButton id="btn" label="LinkButton control" color="#0000FF" fontWeight="bold" rollOverColor="#FFFFFF"
mouseOver="linkbutton1_mouseOverHandler(event)"
mouseOut="linkbutton1_mouseOutHandler(event)"
click="linkbutton1_clickHandler(event)"/>
点击Display text as hyperlink in Flex和http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/LinkButton.html
了解详情