-
loading data to combo box from xml
iam unable to load all the data from xml file to combo box................
this my code in the first frame:
var My_order:XML = new XML();
My_order.ignoreWhite = true;
My_order.load("company_name.xml");
//
My_order.onLoad = function(success) {
if (success) {
comp_brandArray = My_order.firstChild.childNodes;
for (var i = 0; i<comp_brandArray.length; i++) {
company.addItem({label:comp_brandArray[0].firstChild.attributes.name, data:i});
}
} else {
import mx.controls.Alert;
Alert.show("Unable to connect to server. Pls try after some time.........", "Error");
}
};
//--------------
any help is appreciated thanks in advance
-
Flash Gordon
Well you use My_order.load("company_name.xml");
but your xml file is named "company_name.txt"...
Quite an easy error
My letters on the F1 key have faded, how are yours today?
-
sorry for delayed reply McUsher but i couldn't upload the xml file i have attached it as txt file as u can see in the previous code!
i could do this way
My_order.onLoad = function(success) {
if (success) {
comp_brandArray = My_order.firstChild.childNodes;
for (var i = 0; i<comp_brandArray.length; i++) {
company.addItem({label:comp_brandArray[i].firstChild.attributes.name, data:i});
}
} else {
import mx.controls.Alert;
Alert.show("Unable to connect to server. Pls try after some time.........", "Error");
}
};
some other solution here i am skippin some of the data any help!
-
Flash Gordon
Oh, i think you should only change one thing:
My_order.onLoad = function(success) {
if (success) {
comp_brandArray = this.firstChild.childNodes;
My letters on the F1 key have faded, how are yours today?
-
loading data to combo box from xml
hey i figured out here is the code,i got help from my friend, thanks McUsher.........
My_order.onLoad = function(success) {
if (success) {
comp_Array = My_order.firstChild.childNodes;
for (var i = 0; i<comp_Array.length; i++) {
var lengthOfAtr = comp_Array[i].childNodes.length;
for (var j = 0; j<lengthOfAtr; j++) {
if (comp_Array[i].childNodes[j].nodeName == "company") {
company.addItem({label:comp_Array[i].childNodes[j].attributes.name, data:i});
} else {
brandlist.addItem({label:comp_Array[i].childNodes[j].attributes.name, data:i});
}
}
}
} else {
import mx.controls.Alert;
Alert.show("Unable to connect to server. Pls try after some time.........", "Error");
}
};
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|