Grizzly
10-19-2004, 05:02 AM
hi all, im trying to get external data and populate my combo box, i have a text file named cars.txt which contains:
&carName=Mazda3,Mazda6,Mazda Tribute &carValue=car1.htm,car2.htm,car3.htm &totalCars=3
the first variable carName is for the label , while the carValue is its corresponding value
i used this code to get the file:
for the first frame:
stop();
var carURL:String = "cars.txt";
var cars:LoadVars = new LoadVars();
function loadScript() {
cars.load(carURL);
gotoAndStop("loading");
}
loadScript();
then on the second frame ("loading" frame)
function carsLoaded(){
gotoAndStop("display");
}
cars.onLoad= carsLoaded;
then finally the last frame ("display" label):
stop();
var allCars:Number = cars.totalCars;
var carName:String = car.carName.split(",");
var carValue:String = car.carValue.split(",");
cars_cb.addItem("Choose a car");
for(i=0;i>allCars;++i) {
cars_cb.addItemAt(i, carName+i, carValue + i);
};
unfortunately i'm not getting any results, all i see in the combobox is "Choose a car", i traced the variables and i get a "undefined,undefined"
sombody help!!! :confused:
&carName=Mazda3,Mazda6,Mazda Tribute &carValue=car1.htm,car2.htm,car3.htm &totalCars=3
the first variable carName is for the label , while the carValue is its corresponding value
i used this code to get the file:
for the first frame:
stop();
var carURL:String = "cars.txt";
var cars:LoadVars = new LoadVars();
function loadScript() {
cars.load(carURL);
gotoAndStop("loading");
}
loadScript();
then on the second frame ("loading" frame)
function carsLoaded(){
gotoAndStop("display");
}
cars.onLoad= carsLoaded;
then finally the last frame ("display" label):
stop();
var allCars:Number = cars.totalCars;
var carName:String = car.carName.split(",");
var carValue:String = car.carValue.split(",");
cars_cb.addItem("Choose a car");
for(i=0;i>allCars;++i) {
cars_cb.addItemAt(i, carName+i, carValue + i);
};
unfortunately i'm not getting any results, all i see in the combobox is "Choose a car", i traced the variables and i get a "undefined,undefined"
sombody help!!! :confused: