Flex 2.0 Primitive Explorer
March 14, 2007
One of the things lacking in Flex 2.0 is the ability to easily draw primitive objects. Whether it be for style enabled itemrenderers, programmatic skins, or a style enabled rating component like the one included with this explorer as a sample. I’ve abstracted the primitive algorithms into handy UIComponents. Direct access to the static drawing utility class is available.
All UIComponent derivatives are completely style enabled including gradient fills, gradient borders, background colors, line thickness etc.. Each primitive UIComponent is ready for itemrenderer, itemeditor, or standalone usage.
Sample code for direct class, mxml, and css use is generated automatically. Future versions will improve upon this. Specifically removing un required tags.
Base set includes Star, Burst, Reverse Burst, Polygon, Gear, Wedge, and Arc. Allot of different shapes can be created with this base set (to many to mention here).
Have a look at the PrimitiveStyles.as styles include file for a list of supported styles 32 in all, and the sample rating component.
The rating component includes the following styles:
The RatingItem has support for a limited set of fill type styles.
I fully intend on continuing the development of this tool. Adding more primitive algorithms, styles, and other ideas I have.
Suggestions for future improvements are most welcome including samples, ideas, bug’s found etc..
The DrawUtils.as static class is based on primitive algorithms originally published here by Ric Ewing and here extended to Flash 8 by Kevin Williams. I then ported them to Flex 2. This class has a due credit mention in it that should remain.
The explorer application code is based off of the Style Explorer and components provided by Adobe Consulting. I did make some changes though. In particular, the color picker wheel rollover actions (it was bugging the heck out of me, sorry Adobe). I removed the mini list that closes as there was really no need for it in this explorer. Lastly the code and sandbox are positioned differently.
A multitude of components and classes to serve a multitude of purposes. Hopefully other Flex developers see the same value as I do in utilities like this one.
Give the components a second to load when you click in the tree there are quite a few properties for modification.
Flex 2.0 Primitive Explorer (rigth click for source).