Actionscript 3 AS3设置组合框背景色?
我有下面的代码来设置组合框下拉列表的样式,但我似乎无法使用背景色。我使用//注释来显示它不喜欢的行:Actionscript 3 AS3设置组合框背景色?,actionscript-3,Actionscript 3,我有下面的代码来设置组合框下拉列表的样式,但我似乎无法使用背景色。我使用//注释来显示它不喜欢的行: var myTextFormat:TextFormat = new TextFormat(); myTextFormat.font = "Arial"; myTextFormat.color = 0xFFFFFF; myTextFormat.size = 10; myTextFormat.background = true; // Doesn't like this line myTextFor
var myTextFormat:TextFormat = new TextFormat();
myTextFormat.font = "Arial";
myTextFormat.color = 0xFFFFFF;
myTextFormat.size = 10;
myTextFormat.background = true; // Doesn't like this line
myTextFormat.backgroundColor = 0xFFFFFF; // Doesn't like this line
var m = 0;
function comboBoxChange(e:Event):void {
var scriptVars:URLVariables = new URLVariables();
trace("YOU CHANGED ME!!!");
//scriptVars["InstructorName" + [m]] = myXML.Instructors.InstructorName[m];
trace(e.target.selectedItem.label);
//Change the comboBox color if Instructor selected
// Go back to plain if no Instructor
if (e.target.selectedIndex == 0){
trace("EMPTY");
e.target.transform.colorTransform = new ColorTransform;
}
else
{
// Shade of black indicates slot allocated to Instructor
my_color.color = 0x002222;
//e.target.transform.colorTransform = my_color;
e.target.parent.alpha = 1;
e.target.textField.setStyle ("textFormat",myTextFormat);
}
}
也许你要找的是
contentBackgroundColor
风格的ComboBox
s|ComboBox {
contentBackgroundColor: red;
}
或
这似乎奏效了:
e、 target.textField.textField.background=true;e、 target.textField.textField.backgroundColor=0x000000 这似乎对我不起作用。但它不会产生任何错误。我使用了:e.target.setStyle('contentBackgroundColor',0x000000);这似乎有效:e.target.textField.textField.background=true;e.target.textField.textField.backgroundColor=0x000000;
combo.setStyle('contentBackgroundColor', 'red');