动态标签和按钮

时间:2009-06-29 06:07:31

标签: actionscript-3 flex flex3

如何在flex 3中创建动态标签和按钮?

1 个答案:

答案 0 :(得分:1)

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
}

除了按钮文本之外,按钮的相同处理将使用btn.Label设置

要添加onclick事件,请使用

btn.addEventListener(MouseEvent.CLICK, ...