Hello

I have create sample example using arraycollection in which

all operation like add/delete/update work perfectly

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical"
                creationComplete="onCreationComplete(event)">

        <mx:Script>
                <![CDATA[
                        import mx.controls.Alert;
                        import mx.events.CollectionEvent;
                        import mx.events.FlexEvent;
                        import mx.collections.ArrayCollection;

                        [Bindable] private var count:int = 0;
                        [Bindable]
                        private var dataArr:ArrayCollection = new 
ArrayCollection
                        ([
                                
{name:"Flex",value:"11",index:0},{name:"Flash",value:"22",index:
1},
                                
{name:"Air",value:"33",index:2},{name:"Photoshop",value:"44",index:
3}
                        ]);

                        private function 
onCreationComplete(event:FlexEvent):void
                        {
                                dataArr.addEventListener
(CollectionEvent.COLLECTION_CHANGE,onCollectionChange);
                        }

                        private function 
onCollectionChange(event:CollectionEvent):void
                        {
                                Alert.show( "Somthing happen with 
ArrayCollection, ADD/DELETE/
UPDATE" );
                        }

                        private function onAdd(event:MouseEvent):void
                        {
                                var n : int = count++;
                                dataArr.addItemAt
( { name:nameTxt.text,value:valueTxt.text,index:n },n);
                        }
                        private function onUpdate(event:MouseEvent):void
                        {
                                dataArr[count].name = nameTxt.text;
                                dataArr[count].value = valueTxt.text;
                                dataArr.refresh();
                        }

                ]]>
        </mx:Script>

        <mx:Form>
                <mx:FormItem>
                        <mx:TextInput editable="false" text="{dataArr.getItemAt
(count).index}" />
                </mx:FormItem>
                <mx:FormItem>
                        <mx:TextInput id="nameTxt" 
text="{dataArr.getItemAt(count).name}" /
>
                </mx:FormItem>
                <mx:FormItem>
                        <mx:TextInput id="valueTxt" text="{dataArr.getItemAt
(count).value}" />
                </mx:FormItem>
        </mx:Form>
        <mx:HBox>
                <mx:Button label="Add" click="onAdd(event)" />
                <mx:Button label="Update" click="onUpdate(event)" />
                <mx:Button label="Previous" click="count--" />
                <mx:Button label="Next" click="count++" />
                <mx:Button label="Delete" click="dataArr.removeItemAt(count)" />
        </mx:HBox>
</mx:Application>

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

With Regards
Virat Patel

On May 28, 5:31 pm, skin <[email protected]> wrote:
> Even i am facing the same problem.. is it some bug or we are doing
> something wrong??  Any answers??
>
> On May 27, 10:04 am, Dinesh Patil <[email protected]> wrote:
>
> >  i have added this listener for to array collection change event , it is not
> > getting fire consistently when collection updted. if it is fired then
> > property name,old value and new value are null in propery change event
> > object.
> > dataAlltimesheets.addEventListener(CollectionEvent.COLLECTION_CHANGE,_dataA­lltimesheets_DPChange);
> > Please any body help me on that.
>
> > Thanks,
> > Dinesh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to