getting label's height to determine it's y within a class
I got something like this:
var myClass:myClass = new myClass;
addChild(myClass.showLabel);
Then, inside this class there's this code:
public class myClass {
private var myLabel:Label;
private var myCanvas:Canvas;
public function myClass() {
myCanvas = new Canvas;
myCanvas.width = 30;
myCanvas.height = 30;
myCanvas.x = 30;
myCanvas.y = 30;
myLabel = new Label;
myCanvas.addChild(myLabel);
}
public function showLabel():Canvas {
myLabel.text = 'example';
myLabel.y = myCanvas.height/2 - myLabel.height/2;
return myCanvas
}
When debuging I see that 'myLabel.height' = 0. I don't know how to find it's final height. I was trying to use myCanvas.validateNow() before determining myLabel.y, but it didn't work.
This is a Flex project, but I don't think this matters.