Take a look at the IViewCursor interface...

private function getItemInCart(item:ShoppingCartItem):ShoppingCartItem{
         cursor = aItems.createCursor();
         sortItems();
         var itemToFind:Object = new Object();
         itemToFind.product = item.product;
         ar found:Boolean = cursor.findFirst(itemToFind);
         f(found){
                 ar sci:ShoppingCartItem = cursor.current as ShoppingCartItem;
         }else{
                 return null;
         }
         return sci;
}

does just what you are looking for without a lot of hassle



At 07:03 PM 6/12/2006, 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?
>
>
>
>No virus found in this incoming message.
>Checked by AVG Anti-Virus.
>Version: 7.1.394 / Virus Database: 268.8.3/360 - Release Date: 6/9/2006


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.394 / Virus Database: 268.8.3/360 - Release Date: 6/9/2006




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Home is just a click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/DHchtC/3FxNAA/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