Roger Heathcote
Roger Heathcote

Reputation: 3515

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 out!)

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

Upvotes: 2

Views: 1992

Answers (1)

bhups
bhups

Reputation: 14875

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.

Upvotes: 3

Related Questions