penmig
11-24-2005, 12:35 AM
Hi guys, I'm using Falsh 8 Pro and I need to position the selection but not an index positioning (selectedIndex) but positioning by a data content, for example a combo with companies where the label is the company name and the data is the code of the company, when I fill the combo from my database I need to show the label of the code of the company I'm working with.
I hope my question is understandable with my poor english.
Thanks for any help
not realy know what you asking for
try this:
//a ComboBox and Button needsto by in the library
createClassObject(mx.controls.ComboBox, "cb", 0, {_x:100, _y:100});
DATA = [{Name:"penmig", L:"Mexico"}, {Name:"Donald", L:"ToonCity"}, {Name:"Xeef", L:"Spain"}];
cb.dataProvider = DATA;
//
createClassObject(mx.controls.Button, "A_btn", 1, {label:"Show Name", _x:200, _y:100});
A_btn.onPress = function() {
_root.cb.labelField = "Name";
};
//
createClassObject(mx.controls.Button, "B_btn", 2, {label:"Land", _x:200, _y:130});
B_btn.onPress = function() {
_root.cb.labelField = "L";
};
//
createClassObject(mx.controls.Button, "C_btn", 3, {label:"Sort Name descend", _x:200, _y:160});
C_btn.onPress = function() {
tmp = _root.cb.dataProvider;
tmp.sortOn("Name",2);
_root.cb.dataProvider = tmp;
};
createClassObject(mx.controls.Button, "D_btn", 4, {label:"Sort Name", _x:200, _y:190});
D_btn.onPress = function() {
tmp = _root.cb.dataProvider;
tmp.sortOn("Name");
_root.cb.dataProvider = tmp;
};
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.