在Flex中用xml做数据源的界面操作的测试
主要解决:
1、xml外部数据的引用,可以用固定xml文件编写测试,之后可以用webservices引用后台数据。
2、对xml数据和界面控件的绑定和操作。
数据源,同在src目录下
data/invoices.xml内容:
<?xml version="1.0"?>
<invoices>
<invoice>
<customer>
<firstname>Maria</firstname>
<lastname>Smith</lastname>
</customer>
<items>
<lineitem price="21.41" quantity="4">Widget</lineitem>
<lineitem price="2.11" quantity="14">Mouse</lineitem>
<lineitem price="8.88" quantity="3">Wrench</lineitem>
</items>
</invoice>
<invoice>
<customer>
<firstname>John</firstname>
<lastname>Jones</lastname>
</customer>
<items>
<lineitem price="7.41" quantity="84">Mouse</lineitem>
<lineitem price="0.91" quantity="184">Mousepad</lineitem>
</items>
</invoice>
</invoices>
--------------------------------------------
界面操作程序
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" fontSize="12" creationComplete="intoApp()">
<mx:Button x="46" y="32" label="getxml" click="show()"/>
<mx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var testxml:XML;
&
相关文档:
第一:拉个DateFormatter 控件
<mx:DateFormatter id="df" formatString="YYYY-MM-DD"/>
精确到时分秒则是YYYY-MM-DD H:NN:SS
第二:写个函数
private function formatStart(item:Object,column:DataGridColumn):String{
  ......
作者: J. Andrew Schafer
这篇文章假设你对 XML, XSLT, 和 C# 熟悉
下载这篇文章的源代码: XMLC.exe (76KB)
译者说明:这篇文章是很早以前就发表了,它提供的源代码是基于 VS.net 测试版(RTM 和 Beta 2)的。
摘要
C# 允许开发人员在源代码中插入XML注释,这在多人协作开发的时候显得特别有用。 ......
flex和后台交互数据最重要是通过异构传输的httpserivce的xml结构。而高效率合理的异步传输数据是flex的开发中的核心。我就公开一下自己面向接口的httpservice的写法。希望有人可以指正。
首先第一个接口是决定通过获取xml的接口:
package com.sunshine.framework. ......
如果要完整的支持XML over TCP,只有两种办法:
1,加一个header去标明数据的长度
2,加一个delimiter去标明数据的结束
这两种方法都不够优雅。我们不需要一个通用的方法,我们只要一个最适合我们的方法。
通常,我们能够自定义数据的格式,而且我们通常一条消息只有一个root node,那么我们可以试试下面的函数:
//re ......
已知有一个XML文件(bookstore.xml)如下:
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
&nb ......