the data in the combobox is var1, var2, var3 i need these to load the strings associated with them to the textbox
this isnt working the way id like it too, it doesnt even trace that theyre loaded...no idea whats wrong..thanks
first of all, you don't need the quotes around the variables in your text file, so your textfile would look like this:
&var1=a
&var2=b
&var3=c
&varloaded=ok
what you also need to do is load the variables into either a level or into a movieclip. i suggest loading them into a movieclip.
code:
this.loadVariables("myfile.txt");
also, you need to use an onData command with that movieclip to verify when the data is loaded.
code:
this.onData = function () {
if (varloaded=="ok") {
trace("data loaded");
// place your data in the combo boxes
}
}
ok i got it to load the variables using a diff method then from above, now that they are loaded when i do
changeHandler
Code:
function loadit() {
trace(comTV.getSelectedItem(comTV.getValue).data);
myTxt.text = comTV.getSelectedItem(comTV.getValue).data;
}
// that returns the variable name and not the actual string associated with the variable
why wouldnt it return the string?
also even tho just the .data value is gettin placed, the first one i click on will stay in the textbox, it wont change when i click on another selection
... imposing your own views is not allways [sic] the ideal or only solution!
what are you on about?
From Flash MX Reference
Usage
myComboBox.getSelectedItem()
Parameters
None.
i merely pointed out to suprme32 that he'd got his usage wrong oldnewbie. maybe i should have sent him to some far off tutorial site instead of actually trying to help him solve his specific problem.....
Originally posted by findShorty what are you on about?
From Flash MX Reference
i merely pointed out to suprme32 that he'd got his usage wrong oldnewbie. maybe i should have sent him to some far off tutorial site instead of actually trying to help him solve his specific problem.....
Kids?
Don't patronise me old man. You have no idea how old I am, and frankly I couldn't care less whether people think i have an attitude problem. When I have time, i do my best to help people out, without passing the buck onto some tutorial site. The fact is, that the way I do things works.
And by the way suprme - sorry for that interuption - in answer to your original problem:
the instance names in your change handler and your combo box did not match. one was ComBo and the other was ComTV.
i changed them and it works fine.
however, when you get to the stage when you are loading the vars in, you'll need an event handler to test whether the variables have loaded into importVars.
so it would be something like:
code:
importVars.onLoad = function () {
//distribute vars to combo box
};
it doesnt work fine tho, cause when you change that (was typo on my part).....click on "test 2" in combo and it says var2 in textbox, it should say "variable 2 loaded"
in the fla you gave me, you haven't distributed any of your data to the combo box. you can't simply write the variables names into the combo box Data values field. at present, var1, var2, and var3 ARE the values you have in the combo box, and thats why these are being displayed.
you need to add the following function to distribute the data:
code:
importVars.onLoad = function () {
for (var i=0; i<3; i++) {
comBo.addItem("my label"+i,importVars["var"+(i+1)]);
}
}
the values do not change when i click on one and then another, always stays on my first choice, also, the combobox values are hardcoded into the combobox, i would rather not load them the way you show, unless its the only way
MY ULTIMATE GOAL!!
this will be used as a description for each combo item, the description is loaded to the box, depending on the variable, the descriptions can get pretty long so i would like to load them from a single textfile, i realize its possible to load 1 description per file, i would like to load all descriptions from 1 file, any way to do this, would be extremely helpful thanks