xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark"
creationComplete="initLabels()">
import mx.controls.Label;
public var label1:Label;
public var label2:Label;
public function initLabels():void {
label1 = new Label();
label1.text = "Change Me";
label2 = new Label();
label2.text = "Change Me";
addElement(label1);
addElement(label2);
}
public function changeLabel(s:String):void {
s = "label" + s;
this[s].text = "Changed";
}
label="Change Other Label" />
label="Change Other Label" />