0 Replies Latest reply on Jul 27, 2012 5:31 AM by dheer83

    Problem with Sort.findItem() in flex4.5


      I am not getting the expected results using Sort.findItem().

      Please find below the example, i am always getting the index  value as "0".

      Though, the currect answer is 2

      am i missing something???. Thanks in advance...


      <?xml version="1.0" encoding="utf-8"?>

      <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"






                          <s:ArrayCollection id="collection">

                                    <fx:Object name="Suraj" age="28"/>

                                    <fx:Object name="Ramu" age="35"/>

                                    <fx:Object name="Ganesh" age="54"/>






                                    import mx.collections.Sort;

                                    import mx.controls.Alert;


                                    private function checkIndex(event:MouseEvent):void


                                              var sort:Sort = new Sort();

                                              var index:int = sort.findItem(collection.source, {name:"Ganesh"}, Sort.FIRST_INDEX_MODE);

                                              Alert.show("The value is " + index as String, "Result");





                <s:Button id="myBtn" label="Find" click="checkIndex(event)"/>