配列を変更しても、dataProvider を再割り当てする必要がある変更がリストに「通知」されません。
var barColours:Array = new Array();
barColours = ["red", "green", "blue", "orange", "purple"];
comboBox.dataProvider = new DataProvider(barColours);
comboBox.addEventListener(Event.CHANGE, onChange);
comboBox.x = 670;
comboBox.y = 55;
minus_btn.addEventListener(MouseEvent.CLICK, takeAwayCol);
function takeAwayCol(ev:MouseEvent):void
{
barColours.pop();
comboBox.dataProvider = new DataProvider(barColours);
}
コメントごとに編集
var barColours:Array = ["red", "green", "blue", "orange", "purple"];
var removedBarColours:Array = new Array();
comboBox.dataProvider = new DataProvider(barColours);
comboBox.addEventListener(Event.CHANGE, onChange);
comboBox.x = 670;
comboBox.y = 55;
minus_btn.addEventListener(MouseEvent.CLICK, takeAwayCol);
function takeAwayCol(ev:MouseEvent):void
{
//if you need to pull from the beginning of the list instead of the end use shift/unshift method(s) of Array
removedBarColours.push(barColours.pop());
comboBox.dataProvider = new DataProvider(barColours);
}
function addCol(ev:MouseEvent):void
{
barColours.push(removedBarColours.pop());
comboBox.dataProvider = new DataProvider(barColours);
}