[ Paulo Rizkalla ] RIA Developer

March 28, 2007

Adding Skins to Custom SliderThumb States in Flex 2.0

Filed under: Skinning — Paulo Rizkalla @ 9:57 pm

My latest project required me to skin an HSlider component that was to be used as a volume control. The skin for the slider thumb was an image of a speaker that showed sound waves according to the position on the slider track to represent the volume level (no waves representing mute, and 5 waves representing max volume). I initially tried using setStyle() to dynamically set the three corresponding states (UP, OVER, DOWN) for each position of the thumb, but noticed that there was slight performance downgrade and decided to investigate. Turns out that setStyle() is very process intensive and should be used sparingly (Flex help has a comment on that). So after some more research I realized I could just create new custom skin states to the slider thumb in a subclass to the SliderThumb class. This allowed me to use css to define each skin asset and in the custom class write the methods to handle the skin swaps.

Advertisement

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Theme: Rubric. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.