je travaille avec Flex 4 webservices de machine virtuelle Java invoquant 1.6Problèmes avec les méthodes asynchrones
Je suis en train de faire des appels asynchrones à java pour remplir trois comboboxes qui afficheront les pays, les Etats et les villes, ces trois sont liés (relation maître-esclave) mais parfois les appels ne sont pas respectés, ou ils ne sont pas terminés, et je pense que c'est parce qu'ils sont asynchrones, comment puis-je être sûr que je fais l'appel pour remplir la prochaine combobox quand le maître combobox (pays) est rempli?
fonction comboCountry_changeHandler protégé (idCombo: String): void {
selectedComboCountry= idCombo;
var countryId:String;
if(selectedComboCountry == comboCountry.id){
countryId = String(comboCountry.selectedItem.countryId);
}else if(selectedCombocountry == combocountrySuc.id){
countryId = String(comboCountrySuc.selectedItem.countryId);
}
obtainStatesResult.token = wsfacturas.obtainStates(countryId);
}
fonction protégée obtainStatesResult_resultHandler (event: ResultEvent): void {var StateListVo: ArrayCollection = obtainStatesResult.token.result comme ArrayCollection;
if(selectedComboCountry == "comboCountrySuc"){
StateListsSuc.removeAll();
CityListsSuc.removeAll();
for (var d:int = 0; d < StateListVo.length; d++){
var estSuc:State = StateListVo[d];
StateListsSuc.addItem(estSuc);
}
comboStateSuc.dataProvider = StateListsSuc;
}
else if(selectedCombocountry == "combocountry"){
StateListsEmp.removeAll();
CityListsEmp.removeAll();
for (var i:int = 0; i < StateListVo.length; i++){
var estEmp:State = StateListVo[i];
StateListsEmp.addItem(estEmp);
}
comboState.dataProvider = StateListsEmp;
} else {
for (var f:int = 0; f < StateListVo.length; f++){
var est:State = StateListVo[f];
StateListsSuc.addItem(est);
StateListsEmp.addItem(est);
}
comboState.dataProvider = StateListsEmp;
comboStateSuc.dataProvider = StateListsSuc;
}
}
fonction comboCountry_changeHandler protégé (idCombo: String): void \t \t \t {\t \t \t \t \t \t \t \t \t \t \t selectedComboCountry = idCombo; \t \t \t \t var countryId: String; \t \t \t \t if (selectedComboCountry == comboCountry.id) { \t \t \t \t \t countryId = String (comboCountry.selectedItem.countryId); \t \t \t \t \t \t \t \t} else if (selectedCombocountry == combocountrySuc.id) { \t \t \t \t \t countryId = Chaîne (comboCountrySuc.selectedItem.countryId); \t \t \t \t} \t \t \t \t \t \t \t \t \t \t \t \t \t \t obtainStatesResult.token = wsfacturas.obtainStates (countryId); \t \t \t \t \t \t \t \t \t \t \t \t} – overmann
fonction protégée obtainStatesResult_resultHandler (événement: ResultEvent): void \t \t \t { \t \t \t \t var StateListVo: ArrayCollection = obtainStatesResult.token.result comme ArrayCollection; \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t if (selectedComboCountry == "comboCountrySuc") { \t \t \t \t \t \t \t \t \t \t StateListsSuc.removeAll(); \t \t \t \t \t CityListsSuc.removeAll(); \t \t \t \t \t for (var d: int = 0; d
overmann
else if (selectedCombocountry == "combocountry") { \t \t \t \t \t StateListsEmp.removeAll(); \t \t \t \t \t CityListsEmp.removeAll(); \t \t \t \t \t for (var i: int = 0; i
overmann