Hi

I'll do something like this.

First create a empty array. Then loop into your ComboBox like I show you before. Each step of the loop, test if the value is allready in the array. There is no method of array class to do that, but you can cast the array as string and use the method indexOf of the string class, something like this:

if (myArray.toString().indexOf(myValue)==-1) { ...

-1 means that the value is not in the string, then it's the first occurence of this value. So push the value into the array for futur test and push also this value into your second ComboBox.

If the value appears again, indexOf will return a positiv or 0 number, then it's not pushed into your second ComboBox.

David Buff


----- Original Message ----- From: "Laurent CUCHET" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <[email protected]>
Sent: Monday, October 23, 2006 12:28 PM
Subject: [Flashcoders] >> find same label


Is there a way to find same la bel in a combobox and let only one same label
??

my_cb.addItem({data:1, label:"One"});
my_cb.addItem({data:2, label:"Two"});
my_cb.addItem({data:3, label:"One"});
my_cb.addItem({data:4, label:"Two"});


var cbListener:Object = new Object();
cbListener.change = function (evt_obj:Object) {
trace("Currently selected item is: " + evt_obj.target.selectedItem.label);
}
my_cb.addEventListener("change", cbListener);
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to