View Full Version : getting component.setWidth working?

01-07-2003, 04:41 AM
Anyone tried playing around with the FListBox or FComboBox setWidth option? its got me stumped :confused:

Perhaps im missing something obvious....

i've got a load of dynamic content im loading into a FListBox from a PHP file (this works np), then checking the longest string (from the PHP file) with a view to using this amount as a guide to setting the width of my FListBox.

sounds simple enough but .setWidth or .setSize has no effect, including when i use it with .setRowCount :rolleyes:

i've gone thru the MM site & most FlashMX forums and there's no additional info appart from the Manual:

Method; specifies the width of the list box, in pixels. This method is useful for setting the width of list box when FListBox.setRowCount is used to determine the height.

thanks in advance for your help :D

01-07-2003, 01:56 PM
I don't know if this helps, but I got the following to work.

function getWidth() {
var longest = 0;
var len = mylistbox.getLength();
for (i=0; i<len; i++) {
var count = mylistbox.getItemAt(i).label;
if (count.length > longest) {
longest = count.length;



01-07-2003, 02:19 PM
i don't know what your doing, but this set the width of the list box fine for me.

//set width to 100
//set width to 250

01-07-2003, 03:01 PM
Ah thats it, attach the FListBoxSymbol from the Library :D

lbower, nice function for checking the longest string!

thanks both of you!