|
以前にもどこかにメモったはずなのに、見つからなくなってしまったので、再び調べてメモっておきます。 Flash/Flex でマウスカーソルを手の形に変える時は、useHandCursor を true にセットします。ただし、このとき、buttonMode プロパティが true に設定されている必要があり、かつ、Flex のコンポーネントなどの場合は、子をもっているので、mouseChildren プロパティを false に設定します。 Flex のマニュアルにもあるけど <mx:Label> でハンドカーソルを表示させる場合、useHandCursor および buttonMode プロパティを true に設定し、mouseChildren プロパティを false に設定します。 this.useHandCursor = true; this.buttonMode = true; this.mouseChildren = false; これで簡単にマウスカーソルを変更できます。また、CursorManager を使うことで独自カーソルを設定することもできます。 試しに適当なコンポーネント(HTMLのリンクラベルのような)を作ってみました。 file: KujiraLinkLabel.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Label xmlns:mx="http://www.adobe.com/2006/mxml"
initialize="onInit()"
mouseOut="onMouseOut()"
mouseOver="onMouseOver()"
buttonMode="true"
useHandCursor="true"
mouseChildren="false"
textDecoration="underline"
>
<mx:String id="color">#000044</mx:String>
<mx:String id="mouseOverColor">#0000aa</mx:String>
<mx:Script>
<![CDATA[
import mx.managers.CursorManager;
private function onMouseOver():void {
this.setStyle('color',this.mouseOverColor);
}
private function onMouseOut():void {
this.setStyle('color',this.color);
}
private function onInit():void {
this.buttonMode = true;
this.useHandCursor = true;
}
]]>
</mx:Script>
</mx:Label>
関連記事:
コメント→コメント編集
|