I'm using the fl.controls.Slider class and I can't get it to show a hand cursor when hovering over it. Here's my code.
import fl.controls.Slider;
var 开发者_开发知识库slider : Slider = new Slider();
slider.x = 100;
slider.y = 100;
slider.width = 168;
slider.mouseEnabled = true;
slider.useHandCursor = true;
slider.buttonMode = true;
slider.mouseChildren = true;
addChild( slider );
What am I doing wrong?
fl.controls don't show a hand cursor when enabled. Silly I know. I did find a way to get it to work though. Pass your Slider instance into this function:
function addButtonMode(display:*):void
{
if (display is Sprite)
{
for (var i:int = 0;i < display.numChildren;i++)
{
addButtonMode(display.getChildAt(i));
}
display.useHandCursor = true;
display.buttonMode = true;
}
}
BaseButton( slider.getChildAt( 0 ) ).useHandCursor = true;
BaseButton( slider.getChildAt( 0 ) ).buttonMode = true;
BaseButton( slider.getChildAt( 1 ) ).useHandCursor = true;
BaseButton( slider.getChildAt( 1 ) ).buttonMode = true;
This is the code I ended up using.
精彩评论