今天遇到一個彼爲上火的問題,在MXML中定義了一個Panel,想在as中爲它加畫一個標籤,代碼如下,可是標籤就是畫不上去.
main.mxml:
DrawGrph.as
把第10行的dg.drawAxis(uiAxis);中的uiAxis直接改成gPa,則標籤可以顯示出來,換成UIComponent類型的uiAxis就顯示不了,整了半天也沒整明白,後來終於解決了。原來必須爲Label設置width,heigth屬性,“make certain that the uicomponent you are drawing in has a width”,在12行後加上lab.width=100; lab.height=100;標籤就顯示出來了。