2010-01-20 53 views
1

我有以下代碼給我一個錯誤。我想以編程方式和在%加width屬性:以編程方式添加%值

firstcombo.width = 90%;

但是,這使我有以下錯誤:

  • 1084語法錯誤冒號之前預期 rightparen

什麼正確的語法?

回答

3

嘗試:

firstcombo.percentWidth = 90; 
+1

查看Adobe LiveDocs:http://livedocs.adobe.com/flex/3/langref/mx/core/UIComponent.html#percentWidth - 我認爲這是OP的意圖。 – MattK 2010-01-20 22:56:05

+0

+1我必須同意你的看法,馬特,看起來像意圖,以及實現它的正確方法。 – invertedSpear 2010-01-20 23:01:36

+0

我明白了,的確你是對的。 – 2010-01-20 23:37:04

0

寬度組合框屬性是一個數。你需要相應地設置它。 類似於firstCombo.width = .9 * X其中X是您想要的90%的值。