You need an associative array.  You won't need to check for duplicates 
that way -- its built into the datatype.

http://livedocs.macromedia.com/labs/1/flex20beta3/00001584.html

var myArray:Array = new Array();
var testArray1:Array = [{Classname:"class 10",data:1},{Classname:"class 
10",data:1}];
var testArray2:Array = [{Classname:"class 10",data:2},{Classname:"class 
10",data:2}];

myArray[testArray1] = testArray1;
myArray[testArray2] = testArray2;
myArray[testArray1] = testArray1;
myArray[testArray2] = testArray2;
myArray[testArray1] = testArray1;
myArray[testArray2] = testArray2;
myArray[testArray1] = testArray1;
myArray[testArray2] = testArray2;
myArray[testArray1] = testArray1;
myArray[testArray2] = testArray2;

Even after all that, myArray still only contains two elements.

make sense?  it is early and I'm not the best at explaining things at 
this hour.

ekokurtz wrote:
> I'm trying to figure out the syntax to check for the existence of a 
> value in an array (that's inside an array collection) to see if I 
> need to add a new entry or ignore (to get an array of unique 
> entries).  I had originally tried using array.indexOf but that will 
> only work with simple arrays.
> 
> here is an example of what I am trying, but the 'contains' statement 
> only evaluates to false, regardless of what I have tried.
> 
> function testArray() {        
>       var test:Array = [{Classname:"class 10",data:1},
> {Classname:"class 11",data:2}];       
>       var testAc:ArrayCollection = new ArrayCollection(test);
>       //Alert.show(testAc[1].Classname.indexOf('class 11'));
>                       
>       for (var i=0;i<test.length;i++) {
>               Alert.show(testAc.contains('class 10').toString());
>       }
> 
> }
> 
> Any ideas?


------------------------ Yahoo! Groups Sponsor --------------------~--> 
You can search right from your browser? It's easy and it's free.  See how.
http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to