1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
private function ajoutPlat(evt : MouseEvent) : void
{
ordonnee =ordonnee+40;
var cboxTypPlat :ComboBox = new ComboBox();
cboxTypPlat.width = cboxOrgTypPlat.width;
cboxTypPlat.dataProvider = typePlatXml;
cboxTypPlat.labelField = "@type";
cboxTypPlat.y = ordonnee;
cboxTypPlat.x = cboxOrgTypPlat.x;
cboxTypPlat.visible = true;
var cboxPlat : ComboBox = new ComboBox();
cboxPlat.y = ordonnee;
cboxPlat.x = cboxOrgPlat.x;
cboxPlat.visible=false;
cboxPlat.width = cboxOrgPlat.width;
cboxPlat.dataProvider = ProduitXml;
cboxPlat.labelField = "@product";
evt.currentTarget.parent.addChild(cboxPlat);
evt.currentTarget.parent.addChild(cboxTypPlat);
evt.currentTarget.y = evt.currentTarget.y + 40;
cboxTypPlat.addEventListener(ListEvent.CHANGE,filter('type',cboxTypPlat.selectedLabel ,cboxPlat));
}
private function filter(_filterBy:String , label : String, cbox : ComboBox): void
{
var _filterValue : String = label;
var filterBy:String = _filterBy;
var filterValue:String = _filterValue;
if (_filterValue=="" ||_filterValue=="Tous") {cbox.dataProvider = ProduitXml;}
else
{
cbox.dataProvider = ProduitXml.(attribute(filterBy) == filterValue);
cbox.visible =true;
}
} |
Partager