画图程序的雏形
private function loadComplete():void
{
button.label="canvas click add";
g.addEventListener(MouseEvent.MOUSE_DOWN,onClickHandle);//单击事件
}
private function onClickHandle(event:MouseEvent):void
{
button.label=event.localX+":"+event.localY;
g.graphics.clear();
g.graphics.beginFill(0x6F0A13);
g.graphics.drawCircle(event.localX, event.localY, 7);
g.graphics.endFill();
}
datagrid自定义排序和翻页
private function loadComplete():void
{
adg1.dataProvider=dpADG;
adg1.addEventListener(AdvancedDataGridEvent.SORT,doSort);//增加排序事件
}
private function doSort(event:AdvancedDataGridEvent):void//重新定义排序的内容
{
var orderColumn:int = event.columnIndex;
debugText.text=debugText.text+"\n"+orderColumn;
var col:AdvancedDataGridColumn = adg1.columns[orderColumn];
debugText.text=debugText.text+"\nsorttype="+col.sortDescending;
//col.sortDescending=!col.sortDescending;
//可以在此重新加载数据
/*
if(event.dataField=="Album")
{
debugText.text=debugText.text+"\n"+"changeData";
dpADG= new ArrayCollection([
new Song('kkk','rrr',88.7),
new Song('www','fff',99.7)
])
adg1.dataProvider=dpADG;
}
*/
}
<mx:GridItem width="100%" height="100%">
<mx:LinkButton label="首页">
</mx:LinkButton>
<mx:LinkButton label="上一页">
</mx:LinkButton>
<mx:LinkButton label="下一页">
</mx:LinkButton>
<mx:LinkButton label="末页">
</mx:LinkButton>
</mx:GridItem>
private function loadComplete():void
{
button.label="canvas click add";
g.addEventListener(MouseEvent.MOUSE_DOWN,onClickHandle);//单击事件
}
private function onClickHandle(event:MouseEvent):void
{
button.label=event.localX+":"+event.localY;
g.graphics.clear();
g.graphics.beginFill(0x6F0A13);
g.graphics.drawCircle(event.localX, event.localY, 7);
g.graphics.endFill();
}
datagrid自定义排序和翻页
private function loadComplete():void
{
adg1.dataProvider=dpADG;
adg1.addEventListener(AdvancedDataGridEvent.SORT,doSort);//增加排序事件
}
private function doSort(event:AdvancedDataGridEvent):void//重新定义排序的内容
{
var orderColumn:int = event.columnIndex;
debugText.text=debugText.text+"\n"+orderColumn;
var col:AdvancedDataGridColumn = adg1.columns[orderColumn];
debugText.text=debugText.text+"\nsorttype="+col.sortDescending;
//col.sortDescending=!col.sortDescending;
//可以在此重新加载数据
/*
if(event.dataField=="Album")
{
debugText.text=debugText.text+"\n"+"changeData";
dpADG= new ArrayCollection([
new Song('kkk','rrr',88.7),
new Song('www','fff',99.7)
])
adg1.dataProvider=dpADG;
}
*/
}
<mx:GridItem width="100%" height="100%">
<mx:LinkButton label="首页">
</mx:LinkButton>
<mx:LinkButton label="上一页">
</mx:LinkButton>
<mx:LinkButton label="下一页">
</mx:LinkButton>
<mx:LinkButton label="末页">
</mx:LinkButton>
</mx:GridItem>