Read up on the Flex component life cycle, specifically the invalidation methods.
Basically what's happening is that you are asking for the width immediately after changing the text but Flex doesn't update the width until the next frame.
There are two ways you can work with this:
1)
callLater()
2) invalidation methods
callLater will execute the provided function on a later frame, allowing Flex time to update the dimensions of your CheckBox.
Using the invalidation methods will force Flex to do all the updating immediately. In your case I believe you'd want to do something like:
ActionScript Code:
var check:CheckBox = new CheckBox();
check.label = "Video 1";
check.invalidateSize();
check.validateSize();
trace(check.width);
My personal feeling is that using the invalidation methods in this manner is working against Flex rather than with it. You'd probably be better served by overriding
updateDisplayList() and doing your sizing there.