Change UIComponent from fixed width to fit content
I have a custom alert box I wrote. It has an optional second button. I use the alert box in various ways which may or may not need the second button.
Previously I was creating and adding the button dynamically, but because flash is so slow I have to preload the alert with two buttons.
So there are always two buttons in this alert view. So if I have an alert with both an action button and a cancel button, then I have an alert with just a cancel button I want to hide the action button. However if I set the action button to hidden it still throws off the alginment of the cancel button in my HGroup because it's still taking up space even though it's not there. If I set the width of the action button to 0 then I am using a fixed with and whenever I need to use it again I will have to manually calculate the width of the button!! Is there a way to set the width to 0 then set it like it never had a width at all?
Hope this makes since!
Thanks.