In my previous post, I explained how to create nice gradients using Degrafa’s CSSSkin. Once again, CSSSkin is one of the very powerful, yet overlooked function of the Degrafa framework (look at this, or that for those who would still doubt it). But it has in my opinion a limitation: it works almost only for containers (Canvas, Panel, List, etc). But as it stands by default in the latest version (Beta 3.1), it doesn’t work for buttons (Button, ButtonBar and the like). When it comes to the define CSS tags like upSkin, downSkin, selectedOverSkin, etc, there’s no choice but to use tailor made classes extending GraphicBorderSkin like in this example. But actually, there’s a rather easy way to use CSSSkin defined in a CSS file only, by simply extending CSSSkin.

This is why I’ve created the following class, CSSButtonSkin:

And now an example on how to use it (click to launch then right-click to see the code):

AutosizeTextArea Example

Degrafa CSSButtonSkin Example (click to Launch)

Note that the “child skin” (upSkin for example) inherits its parent’s styles, so there’s no need to re-declare them.

Now that was easy, wasn’t it?

Related posts:

  1. Degrafa: nice and easy gradients with CSSSkin Some examples and explanations on how to easily create nice...
  2. My take on Pong using Flex, Away3D, Mate, Degrafa and, uh, Efflex A Flex version of Pong, using Away3D engine, Mate framework,...
  3. Mate examples: #5 LocalEventMap This is the fifth of a series of gradually more...
  4. Mate examples: #1 A very basic injectors example This is the first of a series of gradually more...
  5. Mate examples: #6 Reset Countdown (pt 1) This blog post is related to My LFPUG Presentation about...

Related posts brought to you by Yet Another Related Posts Plugin.

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 4.00 out of 5)
Loading ... Loading ...