內嵌資源:
圖片
a) 內聯方式內嵌:<mx:Button label="my button" icon="@Embed(source='myImage.gif')"/>
b) 使用ActionScript綁定
<mx:Script>
<![CDATA[
[Embed(source="myImage.gif")]
[Bindable]
public var imaCls:Class;
]]>
</mx:Script>
<mx:Button label="my button" icon="{imgCls}"/>
swf和音頻文件
<mx:script>
<![CDATA[
[Embed(source="mySound.mp3")]
[Bindable]
public var mySound:Class;
[Embed(source="mySWF.swf")]
[Bindable]
public var mySWF:Class;
]]>
</mx:script>
Flex 打印
基本打印:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.printing.FlexPrintJob;
private function print():void {
// create print job
var printJob:FlexPrintJob = new FlexPrintJob();
if(printJob.start()){
// add page
printJob.addObject(myLabel,"none");
// send to printer
printJob.send();
}
}
]]>
</mx:Script>
<mx:Label id="myLabel" text="Hello World" />
<mx:Button click="print()" label="Print" />
</mx:Application>
打印多頁
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.printing.FlexPrintJob;
private function print():void {
// create print job
var printJob:FlexPrintJob = new FlexPrintJob();
if(printJob.start()){
// add 2 pages
printJob.addObject(page1,"none");
printJob.addObject(page2,"none");
// send to printer
printJob.send();
}
}
]]>
</mx:Script>
<mx:Label id="page1" text="Hello World page 1" />
<mx:Label id="page2" text="Hello World page 2" />
<mx:Button click="print()" label="Print" />
</mx:Application>
打印表格數據
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="initData()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.printing.FlexPrintJob;
[Bindable]
public var dp:ArrayCollection;
// populate the dataProviders for the datagrids
private function initData():void{
this.dp = new ArrayCollection();
for(var i:Number=0; i<60; i++){
this.dp.addItem({row:i,data:"item " + i});
}
}
public function print():void {
// create print job
var printJob:FlexPrintJob = new FlexPrintJob();
// start print job
if(printJob.start()){
// add the print grid
printJob.addObject(printGrid);
while(true) {
// loop through print grids data and add additonal pages if neccessary
printGrid.nextPage();
if(!printGrid.validNextPage){
printJob.addObject(printGrid);
break;
}
}
// send to printer
printJob.send();
}
}
]]>
</mx:Script>
<mx:DataGrid id="dataGrid" dataProvider="{dp}" height="200" width="200">
<mx:columns>
<mx:DataGridColumn dataField="row" headerText="Row Number" />
<mx:DataGridColumn dataField="data" headerText="Row Data" />
</mx:columns>
</mx:DataGrid>
<mx:Button click="print()" label="Print" />
<mx:PrintDataGrid visible="false" id="printGrid" dataProvider="{dp}" height="700" width="600">
<mx:columns>
<mx:DataGridColumn dataField="row" headerText="Row Number" />
<mx:DataGridColumn dataField="data" headerText="Row Data" />
</mx:columns>
</mx:PrintDataGrid>
</mx:Application>
| |||||||||
日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
---|---|---|---|---|---|---|---|---|---|
27 | 28 | 1 | 2 | 3 | 4 | 5 | |||
6 | 7 | 8 | 9 | 10 | 11 | 12 | |||
13 | 14 | 15 | 16 | 17 | 18 | 19 | |||
20 | 21 | 22 | 23 | 24 | 25 | 26 | |||
27 | 28 | 29 | 30 | 31 | 1 | 2 | |||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
長春語林科技歡迎您!
常用鏈接
留言簿(6)
隨筆分類
- ajax(2)
- android(5)
- css(2)
- db2(2)
- docker(10)
- flex(22)
- hibernate(16)
- html5(9)
- java(12)
- java8(8)
- jquery(4)
- js(30)
- jsp(2)
- jstl(3)
- linux(14)
- mongodb(1)
- mui(1)
- mysql(14)
- oracle(3)
- spring(8)
- sqlserver(4)
- struts(9)
- struts2(13)
- tomcat(6)
- UML(1)
- util(50)
- vue(1)
- weblogic(1)
隨筆檔案
- 2020年4月 (1)
- 2020年3月 (1)
- 2020年2月 (2)
- 2019年10月 (2)
- 2019年9月 (1)
- 2019年7月 (1)
- 2019年4月 (1)
- 2019年1月 (1)
- 2018年12月 (2)
- 2018年8月 (1)
- 2018年6月 (3)
- 2018年5月 (9)
- 2018年3月 (9)
- 2017年12月 (1)
- 2017年10月 (1)
- 2017年7月 (1)
- 2017年6月 (1)
- 2017年5月 (1)
- 2017年3月 (3)
- 2017年2月 (2)
- 2017年1月 (1)
- 2016年12月 (1)
- 2016年11月 (1)
- 2016年9月 (1)
- 2016年4月 (3)
- 2016年3月 (2)
- 2015年8月 (5)
- 2015年3月 (1)
- 2014年8月 (1)
- 2012年11月 (1)
- 2012年5月 (2)
- 2012年4月 (5)
- 2011年12月 (1)
- 2011年10月 (3)
- 2011年9月 (2)
- 2011年8月 (10)
- 2011年7月 (3)
- 2011年6月 (4)
- 2011年5月 (2)
- 2011年4月 (3)
- 2011年3月 (12)
- 2011年1月 (2)
- 2010年12月 (1)
- 2010年9月 (2)
- 2010年8月 (4)
- 2010年6月 (1)
- 2010年4月 (1)
- 2010年3月 (1)
- 2009年11月 (1)
- 2009年9月 (2)
- 2009年8月 (1)
- 2009年7月 (2)
- 2009年6月 (1)
- 2009年5月 (3)
- 2009年4月 (8)
- 2009年3月 (5)
- 2009年2月 (4)
- 2009年1月 (2)
- 2008年12月 (10)
- 2008年11月 (2)
- 2008年9月 (10)
- 2008年8月 (12)
- 2008年7月 (12)
- 2008年6月 (3)
- 2008年5月 (53)
文章分類
文章檔案
相冊
收藏夾
搜索
最新評論

- 1.?re: js 操作文件[未登錄]
- 00
- --00
- 2.?re: s:bean.jsp
- fdfdsa
- --dfasdf
- 3.?re: hibernate 常用標識生成器
- 藝達廣告歡迎您
- --藝達廣告
- 4.?re: linux mod_jk.so 下載[未登錄]
- 3Q!
- --me
- 5.?re: weblogic參數設置[未登錄]
- 垃圾
- --xx