私は、ボタンの上にマウスを持っていくと手のカーソルになるのが大好きです。
という告白は置いておいて、Flexのボタンやプルダウンで手のカーソルを出そうと思うと、buttonModeプロパティをtrueにセットしてあげる必要があります。
これ、スタイル要素ならいいのですが、普通のプロパティのためCSSで一括指定とかができません。
何かいいやり方がないかなと思っていたのですが、探しても見つからずで、ひとまずこんな実装をしてみました。
import mx.controls.Button; import mx.core.UIComponent; import mx.core.mx_internal; import mx.managers.ISystemManager; use namespace mx_internal; [Mixin] public class ILoveHandCursorMixin { public static function init( sm:ISystemManager ):void { var buttonModeSetFunction:Function = function(event:Event, target:UIComponent):void { if(event.type == FlexEvent.INITIALIZE && target is Button){ target.buttonMode=true; } }; var preSetFunction:Function = UIComponent.dispatchEventHook; UIComponent.dispatchEventHook = preSetFunction==null ? buttonModeSetFunction : function(event:Event, target:UIComponent):void { preSetFunction(event,target); buttonModeSetFunction(event,target); }; } }
このクラスをApplicationとかに private var mixin:ILoveHandCursorMixin; で宣言してやれば動きます。
副次的効果として、ComboBoxやTabなんかもbuttonMode=trueになります。
UIComponent.dispatchEventHookはUI系の全イベントが来ちゃうイベントのるつぼなので、カスタムコンポーネントとかプロパティ設定でやれよJKってことだとは思うんですけど。