# Using combobox

**URL:** <https://forum.kirupa.com/t/using-combobox/319194>\
**Category:** flash\
**Created:** [February 11, 2011, 5:12pm UTC](https://forum.kirupa.com/t/using-combobox/319194 "2011-02-11T17:12:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![WILWILWEL](https://avatars.discourse-cdn.com/v4/letter/w/a88e4f/32.png) [@WILWILWEL](https://forum.kirupa.com/u/WILWILWEL)\
**Post date:** [February 11, 2011, 5:12pm UTC](https://forum.kirupa.com/t/using-combobox/319194/1 "2011-02-11T17:12:52Z")

</div>

I’m walking into a problem with using a combobox. Fetching data into the combobox aint the problem. This part works well.

The part of “getValue” aint working and is giving me “undefined”

The combobox has a instance name: “myComboBox”

and I use the code below to fetch the value of the instance “myComboBox”

var keuze = myComboBox.getValue(data);  
trace (keuze);

it should create a tempory var named “keuze” which should contain the value of the “data parameter” within the combobox named “myComboBox”

then trace the value of the tempory variable “keuze”

as2 code:

> 

//First we make a new loadvars object to hold  
// the variables that are being loaded from the php file.  
myData = new LoadVars();

//this is the part where we execute the  
//function that handles the loaded data.  
myData.onLoad = function(){  
//call the function that handles the data.  
placeTheDataIntoTheRightPlace();  
};

//here we load in the php file, make sure  
//you set the right path to your file!  
myData.load(“[http://www.innerdreamquest.nl/lol/myData.php](http://www.innerdreamquest.nl/lol/myData.php)”);  
// This is the function that handles the actual data.  
// The variables now sorta live in the loadVars object  
// we set named myData so we can call em like:  
// myData.myVariableInthePhpPrintedString.  
placeTheDataIntoTheRightPlace = function(){  
myComboBox.addItemAt(0,myData.comboData1);  
myComboBox.addItemAt(1,myData.comboData2);  
myComboBox.addItemAt(2,myData.comboData3);  
};

var keuze = myComboBox.getValue(data);  
trace (keuze);

php code:

> 

\<?php  
$dataForCombobox\_1 = “This is our FIRST variable, “;  
$dataForCombobox\_2 = “This is our SECOND variable, “;  
$dataForCombobox\_3 = “This is our THIRD variable, “;  
$i=0;  
$num=1;  
while ($i \< $num) {  
echo(”&comboData1=$dataForCombobox\_1”);  
echo(”&comboData2=$dataForCombobox\_2”);  
echo(”&comboData3=$dataForCombobox\_3”);  
$i++;  
}  
?\>
