i have an xml as my source for a model which i use as the source for
arraycollection. in my array collection i may add or remove items.
i would like to get the modified arraycollection back to xml format.
the reason for needing the arraycollection in xml format is i use
zinc to save the xml file locally.
------------------------------------------
public function addPerson():void {
ac.addItem({first:firstInput.text, last:lastInput.text,
email:emailInput.text});
//clearInputs();
}
public function removePerson():void {
if (dg.selectedIndex >= 0) {
ac.removeItemAt(dg.selectedIndex);
}
}
public function updatePerson():void {
if (dg.selectedItem !== null) {
ac.setItemAt({first:firstInput.text, last:lastInput.text,
email:emailInput.text}, dg.selectedIndex);
}
}
<mx:Model id="xmldata" source="1111.xml" />
<mx:ArrayCollection id="ac" source="{xmldata.name}"
collectionChange="collectionEventHandler(event)"/>
<mx:DataGrid width="450" id="dg" dataProvider="{ac}"
change="dgChangeHandler()">
<mx:columns>
<mx:DataGridColumn dataField="first" headerText="First
Name"/>
<mx:DataGridColumn dataField="last" headerText="Last
Name"/>
<mx:DataGridColumn dataField="email" headerText="Email"/>
</mx:columns>
</mx:DataGrid>
<mx:HBox>
<mx:Button label="Add New" click="addPerson();"/>
<mx:Button label="Update" click="updatePerson()"/>
<mx:Button label="Remove" click="removePerson()"/>
</mx:HBox>
------------------------------------
any help will be greatly appreciated...
thanks
keith
--
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/