如何让 flex 中的 LinkBut​​ton 在鼠标悬停时加下划线

How do I get the LinkButton in flex to underline on mouse over

我刚开始使用 flex。我有一个 linkBut​​ton,当我将鼠标悬停在上面时我需要它加下划线。我认为这可以通过 setstyle() 来完成,但我不知道语法及其工作原理。我环顾四周,但它发现任何与此相关的有用信息。

非常感谢任何帮助。

要使用的语法是:

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 and http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/LinkButton.html

查看更多