Is it possible to code a Combo Box so that it auto sizes the width to that of the Pano with the longest name?
Update: I've found this Actionscript code which seems to do what I want:
Code
function autoWidthComboBox()
{
var theComboBox = arguments[0];
if(theComboBox)
{
var stretchTop = arguments[1] ? arguments[1] : false;
var maxWidth = arguments[2] ? arguments[2] : Math.abs(Stage.width - theComboBox._x) - theComboBox.downArrow_mc._width;
var currBiggestWidth = 0;
for(i = 0; i < theComboBox.dropdown.length; i++)
{
theComboBox.selectedIndex = i;
var currItemWidth = theComboBox.textField.focusTextField.textWidth;
if(currItemWidth + theComboBox.downArrow_mc._width < maxWidth)
{
if(currItemWidth > currBiggestWidth)
{
currBiggestWidth = currItemWidth;
trace(currBiggestWidth);
}
}
else
{
currBiggestWidth = maxWidth;
break;
}
}
theComboBox.selectedIndex = 0;
if(stretchTop)
{
theComboBox._width = currBiggestWidth + theComboBox.downArrow_mc._width;
}
theComboBox.dropdownWidth = currBiggestWidth + theComboBox.downArrow_mc._width;
}
}
Display More
But this code was written in 2006 so I'm not sure if it's going to work....