hi guys this is the code messaging services that i implementd... when we
make changes the data in datagrid chart is changin accordingly . I also want
the arraycollection to be updated permannetly with new data that i change in
cell of datagrid by making editable=true...in blazeds destination="chat"
Can anbdy tell me how to mke changes in arraycollection permantly
<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute">

<mx:Script>

<![CDATA[

*import* mx.messaging.events.MessageEvent;

*import* mx.events.CollectionEvent;

*import* mx.messaging.messages.AsyncMessage;

*import* mx.collections.ArrayCollection;

[*Bindable*]

*private* *var* acSales:ArrayCollection=*new* ArrayCollection(

[{Name: *"PopCorn"*, Sales:65.00},

{Name: *"Soda"*, Sales:78.00},

{Name: *"Candy"*, Sales:32.00}]);

*private* *function* initApp():*void*{

myConsumer.subscribe();

acSales.addEventListener(CollectionEvent.COLLECTION_CHANGE,syncClients);

}

*private* *function* messageHandler(event:MessageEvent):*void*{

acSales.removeEventListener(CollectionEvent.COLLECTION_CHANGE,syncClients);

acSales=event.message.body *as* ArrayCollection;

acSales.addEventListener(CollectionEvent.COLLECTION_CHANGE,syncClients);

}

*private* *function* syncClients(event:Event):*void*{

*var* message:AsyncMessage=*new* AsyncMessage();

message.body=acSales;

myProducer.send(message);

}

*public* 
*function*formatLabel(data:Object,field:String,index:Number,percentValue:Number):String{

*return* data.name + *"\n"* +

cf.format(data.sales)+*"\n("*+

nf.format(percentValue) + *"%)"*;

}

]]>

</mx:Script>

<mx:CurrencyFormatter id="cf" precision="2"/>

<mx:NumberFormatter id="nf" precision="1"/>

<mx:Producer id="myProducer" destination="chat"/>

<mx:Consumer id="myConsumer" destination="chat"
message="messageHandler(event)"/>

<mx:Label text="Concession sales" fontWeight="bold" fontSize="14"/>

<mx:PieChart id="chart" dataProvider="{acSales}" width="100%" height="100%">

<mx:series>

<mx:PieSeries field="Sales" explodeRadius=".05" labelPosition="callout"
labelFunction="formatLabel" fontSize="12" fontWeight="bold"/>

 </mx:series>

</mx:PieChart>

<mx:DataGrid dataProvider="{acSales}" editable="true" rowCount="{
acSales.length}" y="349" x="131.5">

<mx:columns>

<mx:DataGridColumn dataField="Name" headerText="Product Name" editable="
false"/>

<mx:DataGridColumn dataField="Sales" headerText="Sales"/>

</mx:columns>

</mx:DataGrid>

</mx:Application>

-- 
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