hi there, Long time AS developer, new Flex developer. Coming from a pure ActionScript background, I've been really banging my head against the Flex framework. I'm working on a Flex 2 project where I need to dynamically instantiate Flex components using ActionScript, and then lay them out manually. I finally got everything sorted out, but I'm wondering if there really isn't a better way to do this.
Basically, I'm creating Flex components at runtime using "new ___()". In particular, I came across a problem trying to modify a Button component that I created inside a Panel. Setting the x and y immediately was no problem, however the width property kept returning 0 . I tried explicitWidth, measuredWidth, every arcane width I could find in the docs, but always 0. Then I realized that the Button probably hadn't finished its layout processes yet. Okay, after some more hand-wrenching, I decided to add a listener to the Button for the FlexEvent.CREATION_COMPLETEevent, and set the props on that. Gods be praised, it worked. The width property finally had a value. But really, this seems very inelegant to me. Don't get me wrong, I love the AS3 event system (mostly), but having to create listener functions just to set visual properties of AS-created components...ugh. Is there a better way to accomplish this? Did I miss something? I think that Adobe needs to concentrate more documentation on using Flex from a non-MXML perspective. It is very frustrating trying to get up to speed with such a complicated framework, when most of the documentation uses MXML to teach concepts. thanks, -brett

