DataGridのデータにXMLを使う
♥0 |
Line 34 |
Modified 2009-12-14 19:07:36 |
MIT License
archived:2017-03-10 06:47:40
ActionScript3 source code
/**
* Copyright _wonder ( http://wonderfl.net/user/_wonder )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/geiy
*/
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" styleName="plain">
<mx:Script>
<![CDATA[
import mx.collections.*;
// XMLデータ
[Bindable]
private var def_xml:XML =
<root>
<person>
<name>suzuki</name>
<money>500</money>
<number>1</number>
</person>
<person>
<name>sato</name>
<money>300</money>
<number>2</number>
</person>
</root>;
// XMLListCollectionを作成する
[Bindable]
private var data_xml:XMLListCollection = new XMLListCollection(def_xml.person);
]]>
</mx:Script>
<mx:Panel width="100%">
<mx:Label text="DataGridのデータにXMLを使う(actionscriptから)" />
<mx:DataGrid width="100%" dataProvider="{data_xml}">
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="名前" />
<mx:DataGridColumn dataField="money" headerText="金額" />
<mx:DataGridColumn dataField="number" headerText="番号" />
</mx:columns>
</mx:DataGrid>
</mx:Panel>
</mx:Application>