Re: [Flashcoders] find same label

2006-10-23 Thread David Buff

Sorry, more simple:

don't push in a array and cast the array as string... just push in a string 
like:


var myString:String = 

and

myString+=value;

David Buff

- Original Message - 
From: David Buff [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Monday, October 23, 2006 5:32 PM
Subject: Re: [Flashcoders]  find same label



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 flashcoders@chattyfig.figleaf.com
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);
___
Flashcoders@chattyfig.figleaf.com
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



___
Flashcoders@chattyfig.figleaf.com
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



___
Flashcoders@chattyfig.figleaf.com
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


RE: [Flashcoders] find same label

2006-10-23 Thread Doug Coning
I actually like using associative arrays to test for duplicate values.
Something like this:

var findItem_array:Array = new Array();
for (var i = 0; i  my_cb.dataProvider.length; i++){
if(findItem_array[my_cb.dataProvider[i].label){
my_cb.removeItemAt(i);
i--;
} else {
findItem_array[my_cb.dataProvider[i].label] = true;
}
}


The above is pseudo code and but the theory should work.

DC
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David
Buff
Sent: Monday, October 23, 2006 11:33 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders]  find same label

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 flashcoders@chattyfig.figleaf.com
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);
 ___
 Flashcoders@chattyfig.figleaf.com
 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
 

___
Flashcoders@chattyfig.figleaf.com
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
 
This e-mail and any attachment(s) are intended for the specified recipient(s) 
only and are legally protected.  If you have received this communication in 
error, please reply to sender's e-mail address with notification of the error 
and then destroy this message in all electronic and physical forms.
___
Flashcoders@chattyfig.figleaf.com
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