I want to create a panel (or any other component) inside a component that has a 5 pixel border on all sides, but scales fully when the window is resized. I know I can set width to "100%" to make it resize, but that gives me no borders. If I put it to "95%", I have borders, but they scale annoyingly. Also, that only works for borders on the right or lower bounds, and not to the left or upper sides.
Is there a convenient way to do this without having to write tons of resize-code (in which case I will not bother and just accept bad rescale behaviour, as it is for a private pet project).
EDIT: I know that I can just overwrite the display handling and set the positions manually every frame. I wondered if there is a cheap way to do it in the mxml-structure, along these lines:
<mx:Panel>
width="100%" height="100%"
</mx:Panel>
Coming from C++ and Java, I am intrigued by the option of setting something to "95%" and let the library work out the details, instead of having to write many lines of code, just so my text-area always keeps a 5 pixel distance from the border, but sca开发者_StackOverflowles with window width.
If there is no easier way to do it than figuring out pixel sizes by hand and setting the coordinates, then that answers my question too. I am not looking for a way to do it, I am looking for a shortcut to do it very easily.
I'm not sure if I got you correctly, but you can use left, right. top and bottom properties setting em all to border width. Setting those values will constrain child component coordinates relative to parent's bounds.
精彩评论