tags:

views:

418

answers:

1

Hi All, How to create dynamic label and button in flex 3?

A: 
public function yourFunction():void
{
   var tmpLbl:Label = new Label();
   tmpLbl.x = 10;
   tmpLbl.y = 5;
   tmpLbl.text = "Label Text";

   yourObj.addChild(tmpLbl);  // where yourObj is the object you want to add the label to
}

Pretty much the same deal for a button except the buttons text would be set with btn.Label

To add an onclick event just use

btn.addEventListener(MouseEvent.CLICK, ...
Chris Klepeis
Thanks Chris.i got the solution.
aravindakumarThangaraju