PDA

View Full Version : resizing combo box with Actionscript


rs_ss350
12-07-2006, 02:48 AM
Hi,

I've got a combo box with labels that are very long... i created the combobox with the following script:

// combo box
this.createClassObject(mx.controls.ComboBox, "my_cb", 10);

my_cb.addItem({data:"/solutions/industry/aerospace/index.htm", label:"Aerospace and Defense"});
my_cb.addItem({data:"/solutions/industry/automotive/index.htm", label:"Automotive"});
my_cb.addItem({data:"/solutions/industry/consumer/index.htm", label:"Consumer Products"});
my_cb.addItem({data:"/solutions/industry/discrete_manufacturing/index.htm", label:"Discrete Manufacturing"});
my_cb.addItem({data:"/solutions/industry/finance/index.htm", label:"Financial Services"});
my_cb.addItem({data:"/solutions/industry/healthcare/index.htm", label:"Healthcare"});

// Position
my_cb._x = 40;
my_cb._y = 520;

// Parameters
my_cb.rowCount = 13;
my_cb.minWidth = 300;

// Create listener object.
var cbListener:Object = new Object();
// Create event handler function.
cbListener.change = function (evt_obj:Object) {
trace("Currently selected item is: " + evt_obj.target.selectedItem.label);
trace("Currently selected url is: " + evt_obj.target.selectedItem.data);
getURL( evt_obj.target.selectedItem.data, "_blank");

}
// Add event listener.
my_cb.addEventListener("change", cbListener);


i attempted my_cb._width = 300; , but this stretches the down button. is there any way to widen the text area so the whole label shows?

thanks!

tg
12-07-2006, 03:16 PM
try:

my_cb.setSize(40,520);


i think this will work for as1.....

rs_ss350
12-07-2006, 04:10 PM
Thanks! that worked... learning something new every day thanks to this site...

one more thing, how do I create an inactive label? searched extensively through the flash help, but no luck...

thanks

tg
12-07-2006, 06:45 PM
what do you mean by an 'inactive label' ??

rs_ss350
12-07-2006, 08:06 PM
what i mean is a disabled list item... it would be the first item in the drop down... it would say something like "choose one.."

thanks