我将使用HSlider设置值范围。我希望左手拇指看起来像(和右手拇指看起来像),这样它们似乎包含了(range)这样的范围,而不是| range |。我只知道如何为SliderThumb设置皮肤,这将为两个皮肤设置皮肤。有谁知道为每个拇指设置不同皮肤的方法吗?
谢谢。
更新
我现在有以下代码:
<?xml version="1.0" encoding="utf-8"?>
<mx:HSlider xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Style>
.thumbTickLeft
{
disabledSkin: Embed(source="skins.swf", symbol="thumbTickLeft_disabledSkin");
downSkin: Embed(source="skins.swf", symbol="thumbTickLeft_downSkin");
overSkin: Embed(source="skins.swf", symbol="thumbTickLeft_overSkin");
upSkin: Embed(source="skins.swf", symbol="thumbTickLeft_upSkin");
}
.thumbTickRight
{
disabledSkin: Embed(source="skins.swf", symbol="thumbTickRight_disabledSkin");
downSkin: Embed(source="skins.swf", symbol="thumbTickRight_downSkin");
overSkin: Embed(source="skins.swf", symbol="thumbTickRight_overSkin");
upSkin: Embed(source="skins.swf", symbol="thumbTickRight_upSkin");
}
</mx:Style>
<mx:Script>
<![CDATA[
override protected function commitProperties():void
{
super.commitProperties();
updateThumbSkins();
}
private function updateThumbSkins():void
{
this.getThumbAt(0).setStyle('styleName','thumbTickLeft');
this.getThumbAt(1).setStyle('styleName','thumbTickRight');
}
]]>
</mx:Script>
</mx:HSlider>
拇指滴答声根本不显示吗?顺便说一下,我已经确保皮肤正确加载,因为我可以将它们设置为如下所示的按钮:
<mx:Button styleName="thumbTickRight"/>
最佳答案
好吧,我能够使它以这种方式工作..不确定这是否是最佳方法。
<?xml version="1.0" encoding="utf-8"?>
<mx:HSlider
xmlns:mx="http://www.adobe.com/2006/mxml"
sliderThumbClass="RangeSliderThumb"
creationComplete="initThumbs()">
<mx:Script>
<![CDATA[
import mx.controls.sliderClasses.SliderThumb;
[Embed(source="skins.swf", symbol="thumbTickLeft_upSkin")]
private var leftUp:Class;
[Embed(source="skins.swf", symbol="thumbTickRight_upSkin")]
private var rightUp:Class;
[Embed(source="skins.swf", symbol="thumbTickLeft_downSkin")]
private var leftDown:Class;
[Embed(source="skins.swf", symbol="thumbTickRight_downSkin")]
private var rightDown:Class;
[Embed(source="skins.swf", symbol="thumbTickLeft_overSkin")]
private var leftOver:Class;
[Embed(source="skins.swf", symbol="thumbTickRight_overSkin")]
private var rightOver:Class;
[Embed(source="skins.swf", symbol="thumbTickLeft_disabledSkin")]
private var leftDisabled:Class;
[Embed(source="skins.swf", symbol="thumbTickRight_disabledSkin")]
private var rightDisabled:Class;
private function initThumbs():void
{
this.thumbCount = 2;
var thumb1:SliderThumb = this.getThumbAt(0);
thumb1.setStyle("thumbUpSkin", leftUp);
thumb1.setStyle("thumbDownSkin", leftDown);
thumb1.setStyle("thumbOverSkin", leftOver);
thumb1.setStyle("thumbDisabledSkin", leftDisabled);
var thumb2:SliderThumb = this.getThumbAt(1);
thumb2.setStyle("thumbUpSkin", rightUp);
thumb2.setStyle("thumbDownSkin", rightDown);
thumb2.setStyle("thumbOverSkin", rightOver);
thumb2.setStyle("thumbDisabledSkin", rightDisabled);
}
]]>
</mx:Script>
</mx:HSlider>
关于apache-flex - Flex:HSlider-为不同的拇指设置不同的皮肤?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1069457/