aravinda
aravinda

Reputation: 71

Dynamic Label and Button

How to create dynamic label and button in flex 3?

Upvotes: 0

Views: 2157

Answers (1)

Chris Klepeis
Chris Klepeis

Reputation: 9993

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, ...

Upvotes: 1

Related Questions