-
[CS3] AS2, making dynamic combobox interactive
So far I have populated the combobox from a PHP script and a MySQL database.
Problem is I have to make each item inside the combobox clickable - I want a textbox to be filled with the value I click on.
My actionscript skills are not that good so hints would be appreciated.
This is my code so far:
Code:
//populating the combobox "dropDown"
function AddItems(Regions_in)
{
var my_str:String = Regions_in;
var my_array:Array = my_str.split(":");
for (i=0; i<my_array.length; i++)
{
region_combobox.addItem(my_array[i]);
// I am not sure how I would add a listener here
}
}
Thanks anyone
-
Okay... so I tried this aswell as many other things and I get undefined as the result inside the textbox - please explain why I get undefined.
Code:
//populating the combobox "dropDown"
function AddItems(Regions_in)
{
var my_str:String = Regions_in;
var my_array:Array = my_str.split(":");
for (i=0; i<my_array.length; i++)
{
region_combobox.addItem(my_array[i]);
postcode_search.text = region_combobox.selectedItem.data;
}
}
Cheers
-
-
FK'n_dog
PHP Code:
function AddItems(Regions_in){
var my_str:String = Regions_in;
var my_array:Array = my_str.split(":");
for (i=0; i<my_array.length; i++){
region_combobox.addItem(my_array[i]);
}
};
AddItems("Select:EX5:EX7:EX8");
obj = new Object;
obj.change = function(comp){
lab = comp.target.selectedItem.label; // trace(lab);
postcode_search.text = lab;
};
region_combobox.addEventListener("change", obj);
hope this example helps you on your way
-
That worked a charm....
Thank you very much.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|