2009-06-29 84 views
0

如何在flex 3中創建動態標籤和按鈕?動態標籤和按鈕

+0

有很多可能的答案爲了這。你能提供一些背景嗎?您在什麼情況下嘗試創建動態標籤?你只是想根據其他變量值來改變按鈕的標籤嗎? – darronschall 2009-07-02 17:33:05

回答

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

謝謝Chris.i得到了解決方案。 – aravinda 2009-07-15 09:23:02