Advanced FXG Spark Icon Buttons with one generic skin in Flex4 (Gumbo)
Keywords: effects, FXG, generic, Icons, pseudo selectors, skinning, states, Transitions
For the past couple of days I’ve had a look at creating Spark Icon Buttons. In this post I’ve created an FXG Icon Button with some transitions, leveraging pseudo selectors for states. The Icon was ‘hardcoded’ into the skin. For another Icon I would need to duplicate the skin and introduce another graphic. Not exactly generic. There are other ways to bring graphics into Spark Skins but none of them work with FXG Elements directly.
What I want is:
- work with FXG Graphic Elements for simpler manipulation and scaling
- easily export the FXG-Definitions for the icons from a tool and/or be able to change them in FB directly
- colorize the icons based on a color style-property and do this per state
- change the icons based on a style-property and do this per state
- change icons at runtime
- scaling effect on icon
- have ONE generic skin, so no duplicates for different icons are necessary
Most of the trouble with generic skins comes from the fact that there is no way to access the FXG Library-Definitions at run-timeĀ (as far as I know) - like getting an instance of a symbol in the library, the way we had in flash. Here’s a hack but I’d rather not use it.
After some headaches I finally managed to get a solution I can live with:
Click here for a test.
You’ll find the source at the end of this post.
The solution regarding the work flow mainly comes down to (more…)
