看看这段代码:
import mx.core.View;
var accordianPane = my_acc.createSegment("mcElectrical", "panel0", "Electrical", "payIcon");
accordianPane.comboBox.addItem("test");
这会将带有标签“test”的项目添加到影片剪辑中的组合框中。它工作得很好。但是,当我将相同的代码放在回调函数中时,它会失败。
import mx.core.View;
// Load Cost Guide feed.
var costGuideUrl:String = "http://test/cost-guide.ashx";
var costGuideXml:XML = new XML();
costGuideXml.onLoad = function(success) {
if(success) {
populateAccordian(this);
} else {
// Display error message.
}
};
costGuideXml.load(costGuideUrl);
// Populate Accordian with retrieved XML.
function populateAccordian(costGuideXml:XML) {
var accordianPane = my_acc.createSegment("mcElectrical", "panel0", "Electrical", "payIcon");
accordianPane.comboBox.addItem("test");
// This line definitely executes...
}
关于为什么我无法从回调内部进入组合框的任何想法?