The following example shows how you can remove the hand cursor from the a Flex LinkButton control by extending the LinkButton class, overriding the enabled setter function, and setting the useHandCursor property.
Full code after the jump.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/09/07/removing-the-hand-cursor-from-a-disabled-linkbutton-control-in-flex/ -->
<mx:Application name="LinkButton_useHandCursor_test"
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:comps="comps.*"
layout="horizontal"
verticalAlign="middle"
backgroundColor="white">
<mx:ApplicationControlBar dock="true">
<mx:Form styleName="plain">
<mx:FormItem label="enabled:">
<mx:CheckBox id="checkBox" selected="true" />
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<mx:LinkButton id="linkButton"
label="Default LinkButton"
enabled="{checkBox.selected}" />
<comps:DisabledLinkButtonMXML id="linkButton2"
label="Custom LinkButton (MXML)"
enabled="{checkBox.selected}" />
<comps:DisabledLinkButtonAS id="linkButton3"
label="Custom LinkButton (ActionScript)"
enabled="{checkBox.selected}" />
</mx:Application>
View source is enabled in the following example.
comps/DisabledLinkButtonMXML.mxml
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/09/07/removing-the-hand-cursor-from-a-disabled-linkbutton-control-in-flex/ -->
<mx:LinkButton xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
override public function set enabled(value:Boolean):void {
super.enabled = value;
useHandCursor = value;
}
]]>
</mx:Script>
</mx:LinkButton>
/**
* http://blog.flexexamples.com/2008/09/07/removing-the-hand-cursor-from-a-disabled-linkbutton-control-in-flex/
*/
package comps {
import mx.controls.LinkButton;
public class DisabledLinkButtonAS extends LinkButton {
/**
* Constructor.
*/
public function DisabledLinkButtonAS() {
super();
}
/**
* @private
*/
override public function set enabled(value:Boolean):void {
super.enabled = value;
useHandCursor = value;
}
}
}



Why would you need to extend the LinkButton?
Setting the ‘
useHandCursor‘ property to the same value as the ‘enabled‘ property works just fine:<mx:LinkButton id="linkButton" label="Default LinkButton" enabled="{checkBox.selected}" useHandCursor="{checkBox.selected}" />@Geert
No… Actually you are binding to the ‘
selected‘ property of a different control.You cannot bind to the ‘
enabled‘ property. The following would not work:<mx:LinkButton id="linkButton" label="Default LinkButton" enabled="{checkBox.selected}" useHandCursor="{linkButton.enabled}" />