开发者

How to change the thumb graphic on a Flash slider

I have a dynamically created slider with AS3. I can reference the thumb by s.getChildAt(1) (that took me quite a while to figure o开发者_运维技巧ut!)

But, how would I assign a new graphic to it?


Slider class is subclass of UIComponent which has method for setting styles for various parts of the component (setStyle(style:String, value:Object):void). Slider class has various set-able styles, and thumbSkins are among them. Following is the list of few of them:

protected static var defaultStyles:Object = {
            thumbUpSkin: "SliderThumb_upSkin",
            thumbOverSkin : "SliderThumb_overSkin", 
            thumbDownSkin: "SliderThumb_downSkin",
            thumbDisabledSkin: "SliderThumb_disabledSkin",
            sliderTrackSkin: "SliderTrack_skin",
            sliderTrackDisabledSkin: "SliderTrack_disabledSkin",
            tickSkin: "SliderTick_skin",
            focusRectSkin:null,
            focusRectPadding:null
        }
So what you need to do is to call s.setStyle("thumbUpSkin", thumbUpSkinShape). thumbUpSkinShape is Shape object with new graphic and so on. If you are more interested in how things happen, you can look into source files. You can find them at CS3_InstallationDir\en\Configuration\Component Source\ActionScript 3.0\User Interface\fl\controls\. Hope it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜