2012-03-09 2 views
0

У меня есть следующий код, который сбрасывает мой comboBox, но я не могу получить цвет фона для работы. Я использовал // комментарии, чтобы показать, какие строки она не любит:AS3 Set Combobox цвет фона?

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); 
    } 

} 
+0

Это, казалось, сработало: \t \t \t e.target.textField.textField.background = true; \t \t \t e.target.textField.textField.backgroundColor = 0x000000; – user1203605

ответ

1

Это, казалось, работало: e.target.textField.textField.background = истина; e.target.textField.textField.backgroundColor = 0x000000;

1

Может быть то, что вы ищете является contentBackgroundColor стиль ComboBox?

s|ComboBox { 
    contentBackgroundColor: red; 
} 

или

combo.setStyle('contentBackgroundColor', 'red'); 
+0

Это не работает для меня. Однако он не производит никаких ошибок. Я использовал это: e.target.setStyle ('contentBackgroundColor', 0x000000); – user1203605

Смежные вопросы