Subscribe to RSS
get email updates
home | about | pixDif AIR app | video tutorials
polyGeek.com

place your ad here

Web Premium



Get Qwest High Speed Internet



s:Rect is the new mx:Spacer

April 26th, 2010 . by polygeek

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.

Post to Twitter Post to Delicious Post to Facebook Post to Reddit Post to StumbleUpon


similar posts

4 Responses to “s:Rect is the new mx:Spacer”


comment number 1 by: Ryan Frishberg

One reason to use over <mx:Spacer> is that Rect is a GraphicElement, which means it shares DisplayObjects and should be lighter-weight than Spacer, which is a UIComponent and a DisplayObject.

comment number 2 by: polyGeek

Thanks for the elucidation. As a general rule I try to use mx as little as possible.

You know what would be ULTR-cool? A chart that shows not just the Flex class inheritance but also the file weight that comes with it. Ummmmm, if only I had the time and had a clue how to measure the weight.

comment number 3 by: Badrusyamsi

Nice share thx

comment number 4 by: muhammadbutt

The Spacer control helps you lay out children within a parent container. Although the Spacer control does not draw anything, it does allocate space for itself within its parent container. look here more
http://satotravel1.info/

   Welcome back (Change)

Leave a Reply

comment feed RSS   subscribe to this comment thread

Recent Posts

   



polyGeek.com

© Copyright 2008 polyGeek.com / Dan Florio, All Rights Reserved Except Where Explicitly Stated
Web Developement Blogs - Blog Catalog Blog Directory
M2 Websites
Local Directory for Los Angeles, CA

Better Tag Cloud