How do you create an mx.controls.Label whose width would automatically
adjust when its .text is reset? Or, at least, how do you figure out which width to set the Label to once its .text is reset? The only thing I came up so far is "label.textWidth + 12" Thanks!
__________________ overstream.net: add subtitles to online videos (youtube, vimeo, blip.tv...).
As far as I can see, you don't need to specify a width for the Label component. It should simply expand or contract to accomodate this string you bind to it.
Thank you, flexy. Your example definitely works. My problem wasn't the binding, though - it was that I was adding my label (via new Label(), addChild()) in a class that was extending mx.core.Container. Once I changed for that class to extend mx.containers.Canvas and added the label the same way, everything worked. I guess it's the container that is supposed to take care of the sizing of the components inside of it, and mx.core.Container simply does nothing, so I had to do it manually somehow. But mx.containers.Canvas does the sizing and layout automatically... I better go read about the component architecture in Flex. For some reason I am finding it very alien, coming from Flash...
__________________ overstream.net: add subtitles to online videos (youtube, vimeo, blip.tv...).
Ah yes, you need to extend a Container class, such as canvas, that already controls sizing and layout of children, otherwise you get the scenario you experienced. One of those things, you'll do it once, but never again!!
Good luck with the 'reading-up'; Flex documentation is sh1te at the moment!