PDA

View Full Version : combobox component



sanman918
September 13th, 2003, 05:28 PM
I'm trying to mack a simple drop down list where each selection has its own value. I have a combo box with the following parameters.
Editable = false
Labels = choice1, choice2
Data = 0,1
Row Count = 8
Change Handler = blank

I have an instance name of "type" on the component. Now I have a dynamic text field with a var of "price" and on the first frame of my movie i have this code
if (_root.type == 0) {
_root.price = 10;
}
if (_root.type == 1) {
_root.price = 20;
}

But its not showing these values in my text field when i select those choices. Any suggestions?

sanman918
September 13th, 2003, 07:14 PM
also, how can I change font and color of the actual text inside the combobox? Any help or directoins would be helpful.

sanman918
September 21st, 2003, 09:25 PM
come on im begging you guys. Help me out! I know some of your flash wiz's have to know it. Im close but i can't get it to work. I need to use the changehandler code but i can't get it to work. Please :)

claudio
September 21st, 2003, 09:45 PM
Set your combobox data to:
Data = 10,20 (or whichever other values you need
Now apply the following code on the timeline:type.setChangeHandler("myHandler");
function myHandler(component){
price = type.getSelectedItem().label;
}

sanman918
September 22nd, 2003, 07:00 PM
that didn;t seem to work, all i get when i do this is it actually says the data in my textbox. I have a text box that I want to display the number values in "10,20" but when i select the words, the textbox with the variable price, just displays "public, or private"

sanman918
September 22nd, 2003, 07:03 PM
nm i got it, had to replace "label" with "data". But is there anyway i can get flash to reconize this right off the bat? Meaning so i don't have to select one, i just just leave it on the first item and still have it tabulate?

sanman918
September 22nd, 2003, 07:10 PM
and also, is there anyway i can do math operations with these. For instance I try.
type.setChangeHandler("myHandler");
function myHandler(component) {
typeob = type.getSelectedItem().data;
}
size.setChangeHandler("myHandler");
function myHandler(component) {
sizeob = size.getSelectedItem().data;
}
price = priceob*sizeob;

can I do this?

sanman918
September 22nd, 2003, 07:12 PM
it seems like i can't put more then one function myHandler in the aciontscript...any suggestions?

eyezberg
September 23rd, 2003, 06:33 AM
you can, but you'll have to use different names!!
myHandler twice won't do the trick..
try adding return typeob/sizeob into the functions..
and use trace(typeob or sizeob) all over the place,
in your functions, in the price calculation etc, so you always know/can check on your data to debug ;)

sanman918
September 23rd, 2003, 04:29 PM
ummm..... going to need a little more explanation. Use different name where? And how to use trace command, i know a little bit about it but i know it can be used for a lot of things. An examples?

sanman918
September 25th, 2003, 05:36 PM
how do i use different names instead of myHandler?

sanman918
September 25th, 2003, 06:19 PM
ok cool i got it to all the seperate values to work. i just played with changing some names and it came out. It was hard because i didn't know what the code was saying but i got it now. But price = typeob*sizeob does not total up. so if you have any idea on what I should do there?