PDA

View Full Version : Resizing Combo Box


teamchuck
05-08-2008, 05:09 PM
This should be a simple question but it is one that is causing me some grief. I'm using AS 2.0 incidentally. I have used this code to create a combo box.

this.createClassObject(mx.controls.ComboBox,"list1",10);
list1._x = 200;
list1._y = 200;
list1.addItem({data:1, label:"One"});
list1.addItem({data:2, label:"Two"});
list1.addItem({data:3, label:"Three"});
list1.addItem({data:4, label:"Five hundred and three"});

I've tried resizing the box like this:
list1._xscale = 150
I'm not sure what the default width of a combo box is, but all this does is stretch the combo box. Then when you click the box the drop down is the original width with a stretched top. How can I have the box automatically resize its width to fit the longest option in the list?