Archive

Archive for February, 2011

DropdownList labelDisplay tooltip

February 22, 2011 1 comment

If you would like to have the DropdownList display a tooltip for the selected item on the labelDisplay component, you have to override the spark DropDownList and set the tooltip on the DropDownList itself rather than the label display.

package
{
	import mx.core.mx_internal;
	
	import spark.components.DropDownList;
	
	use namespace mx_internal;
	
	public class DropDownList extends spark.components.DropDownList
	{
		public function DropDownList()
		{
			super();
		}
		
		override mx_internal function updateLabelDisplay(displayItem:*=null):void
		{
			super.updateLabelDisplay(displayItem);
			
			if ( labelDisplay != null )
			{
				toolTip = labelDisplay.text;
			}
		}
	}
}