views:

70

answers:

4

Hi all,

I have the following code which gives me a error. I want to add the width property programatically and in %:

firstcombo.width = 90%;

But that gives me the following error:

  • 1084 syntax error expecting rightparen before colon

How is the correct syntax?

Greetings Markus

+3  A: 

Try:

firstcombo.percentWidth = 90;
MattK
See the Adobe LiveDocs: http://livedocs.adobe.com/flex/3/langref/mx/core/UIComponent.html#percentWidth -- I think this is the OP's intent.
MattK
+1 I have to agree with you Matt, that looks like the intent, and the correct way to accomplish it.
invertedSpear
@MattK I see, indeed you are right.
Matti
A: 

The width combobox property is a Number. you need to set it accordingly. Something like firstCombo.width = .9 * X where X is the value you want 90% of.

SP
A: 

Hmmm... I would think it is:

firstcombo.width *= .9;

sberry2A
It's zero if firstcombo.width == 0
zdmytriv
A: 

Thank you I tried percentWidth and it worked perfect!

Thanks! Markus

Markus
You should also mark one of the answers (not your own) as the official answer.
Jaanus
yes please, give MattK the rep he deserves for the right answer and prevent this question from being bought back to the top by "community" every so often.
invertedSpear