PDA

View Full Version : Combo Box Help


BChadwick619
05-02-2007, 10:09 PM
Hi I am new to working with combo box's in Flash. Right now I am trying to take the data from a combo box and put it into an action script line, and I dont know if this can be done.
So lets say I have a combo box named: myCombo with the data: dog, cat, fish. When someone selects fish on the combo box I want to load fish into a url string in action script on a button in Flash like:

on (release) {

//Goto Webpage Behavior
getURL("/inventory/search.php/ID_animal/TYPE_"+ myCombo.value,"_self");
//End Behavior

}

So that the value of myCombo is placed into that URL line and then goes to that URL with the fish type selected.

so the end url will look like /inventory/search.php/ID_animal/TYPE_fish/

I know this is very vague and probably hard to understand, I just can't figure out how to post this data from a combo box into an action script.

Lienne
05-02-2007, 10:25 PM
It IS a bit vague, but maybe this will help you. To get the value from a comboBox, use this syntax: "myCombo.selectedItem.label" to get the value of the label, or "myCombo.selectedItem.data" to retrieve the data associated with the selected item (this allows the user to see one thing, while keeping usable strings in the background).

Lemme know if you need more than this.

BChadwick619
05-02-2007, 10:38 PM
Thanks for the quick responce,

So right now my button has this code placed in its action script:


on (release) {

//Goto Webpage Behavior
getURL("/inventory/search.php/ID_animal/TYPE_"+ myCombo.selectedItem.label, "_self");
//End Behavior

}

myCombo has the data [fish,dog] and labels [fish,dog], but with this code it comes back undefined. I have to be doing something wrong

Lienne
05-02-2007, 10:44 PM
try putting a this trace statement above the getURL to make sure you're getting the variable;

trace("myCombo.selectedItem.label = " + myCombo.selectedItem.label);

BChadwick619
05-02-2007, 10:47 PM
Here are some links to my file, the 4 combo boxes on the html above the sumbmit button page are not named. The combobox to the left of the submit button with fish and dog in it is the combo box named myCombo with the values fish and dog, this is the box i want the value to come out in the URL when you click the submit button and go to another page.

Combo Page (http://kia.autofusion.com/Combo/Combo.html)

Combo FLA (http://kia.autofusion.com/Combo/Combo.fla)

Combo swf (http://kia.autofusion.com/Combo/Combo.swf)

This could be way over my head.

BChadwick619
05-02-2007, 10:52 PM
Ok I did that theres nothing comming up in the output except

myCombo.selectedItem.label = undefined when I hit the submit button

Lienne
05-02-2007, 11:05 PM
Looks like you've got a scope issue. Try adding "_root." before the instance name like "_root.myCombo.selectedItem.label" and see if anything comes up.

I wasn't able to open your FLA file for some reason...

BChadwick619
05-02-2007, 11:13 PM
Hey thanks a ton that acutally worked, oh and the reason you cant open the file is becuase I saved it in CS3 and not Flash 8