s:Rect is the new mx:Spacer
Flex 4 leaves a lot of components out such as DataGrid, DateChooser, all the Charting components etc. Those are some rather complex components to re-write. Presumably they’ll be included in an update to Spark someday. But <mx:Spacer /> was left out? How much more simple could a component be?
Turns out that it wasn’t left out by accident because it’s not needed anymore. I was customizing the <s:VideoPlayer /> this weekend and found that they use <s:Rect width=”?” height=”?” /> in place of the <mx:Spacer />.
Example: To create a 20 pixel horizontal space use <s:Rect width=”20″ height=”1″ />. That’s it. No fill or stroke needed, or wanted. That will just create an invisible space.
It doesn’t seem like they went out of their way to publicize that. The code hinting usually mentions something like, “use such-and-such instead” when you start to use an mx component that has a Spark equivalent.
If something here has proved valuable to you then feel free to drop a couple of bucks in the tip-jar.






