How does Flex Size Components?
This question comes in from Corey
I'm a newbie to the world of web development and Flex. I'm currently working on a project that will allow visitors to post stories and allow other users to comment on these stories. Similar functionality to Facebook's "wall." Would you describe for me how to set the size of components (for this example, let's use the standard panel component) to fit the content submitted by the user? Any other helpful tips you feel may be pertinent to this topic are always welcome as well. Thanks.
Well, my first impulse is to say that Flex will automatically size components to fit their content. But, there are some restrictions to that. For example, you can use measuredMinWidth and measuredMinHeight to give the component a minimum size. Other components being placed and sized can also be a factor in how everything is laid out. At the end of the day, however, a component is always sized by it's parent.
If you want to give that parent suggestions, you can implement your own measure method and use that to set the measuredWidth, measuredHeight, measuredMinWidth, and measuredMinHeight. UpdateDisplayList and/or CommitProperties may also help you with sizing; but if this is your first Flex Component I'm not sure if I'd start there.
To create something similar to the facebook wall, you might start with a List class and the variableRowHeight property. Each wall item would size itself inside the list. You could add the commenting feature as a pop-up somehow. Giv me an hour and I'll think up a dozen other ideas to implement something like that.
You can always ask me your question here, or stop by a Flextras Friday Lunch session and ask me in person. If you're really inspired to show you support check out The Flex Show's sponsorship drive.





There are no comments for this entry.
[Add Comment] [Subscribe to Comments]