Hi everyone, out of curiosity I decided to experiment with the following in a Flex 4 project:
public class MyGroup extends Group
{
public function MyGroup()
{
super();
var myLabel:Label = new Label();
myLabel.id = "myLabel";
myLabel.text = "My label!";
this.addElement(myLabel);
} etc.
This custom component does what I'd expect; it looks like a label control with text="My label!".
Question: is there any way to reference the myLabel label control (e.g. to change the text) elsewhere in the project?
At the moment the only way I can get to the inner label control is by calling something like myGroup.getElementAt(0).
I realize that it would make more sense to have the label be a class variable -- I'm just wondering how this code works.