新建一个MXML Component的文件,名字么就觉customdatagrid,flex的代码像java,也像javascrpt,可以自己去看看
1
<?xml version="1.0" encoding="utf-8"?>
2
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300" xmlns:mydg="*">
3
<mx:Script>
4
<![CDATA[
5
以上是自定义控件的代码,下面是使用这个控件的代码2
3
4
5
新建一个Flex Project项目
新建一个MXML Application文件,名字就叫MyDataGrid吧
需在项目中将刚刚编写的Flex Library Project 导入到这个项目中的Library path中
1
<?xml version="1.0" encoding="utf-8"?>
2
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:nsl="*" creationComplete="init()">
3
<mx:Script>
4
<![CDATA[
5
import mx.collections.ArrayCollection;
6
public var items:ArrayCollection;
7
private function init():void
8![]()
2
3
4
5
6
7
8