flex下载

xxxxxx.mxml内容


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal"
applicationComplete="effectEvaluaChartData();"
xmlns:companyname="com.companyname.bass.*"
xmlns:bi="com.companyname.bass.chart.series.*"
xmlns:dropdown="com.companyname.components.*"
paddingTop="0" paddingBottom="0" paddingLeft="0" paddingRight="0">
<mx:Style>
Application{
fontSize:12;
backgroundGradientColors: #D6E4F3, #D6E4F3;
z-index:-1;
}
</mx:Style>
<!-- 脚本-->
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.effects.IAbstractEffect;
import mx.controls.Alert;
import mx.controls.CheckBox;
import mx.controls.ComboBox;
import mx.events.ItemClickEvent;
import mx.controls.TabBar;
import mx.charts.series.items.LineSeriesItem;
import mx.charts.events.ChartItemEvent;
import flash.external.ExternalInterface;
import mx.graphics.codec.JPEGEncoder;
import flash.display.BitmapData;
import mx.core.UIComponent;
//全局变量
private var skinOldPath:String;
//初始化方法
private function effectEvaluaChartData():void
{
//初始化参数
var params: URLVariables = new URLVariables();
params.startDate = this.parameters.startDate;
params.endDate = this.parameters.endDate;
params.areaCode = this.parameters.areaCode;
params.optActId = this.parameters.optActId;
params.guidelineIdJ = this.parameters.guidelineIdJ;
//方法注册
ExternalInterface.addCallback("downExport", downExport); //导出报表
}

//导出报告
private function downExport(startDate:String, endDate:String, areaCode:String, optActId:String, guidelineIdJ:String):void
{
var byteMD:BitmapData = bitmapDataToByteArray(effectEvaluaChart);
var en:JPEGEncoder = new JPEGEncoder(100);
var ba:ByteArray=en.encode(byteMD);
var request:URLRequest = new URLRequest("effectEvalua.do?action=downloadOptEffectEvaluaList&startDate="+startDate+"&endDate="+endDate+"&areaCode="+areaCode+"&optActId="+optActId+"&guidelineIdJ="+guidelineIdJ);
request.method = "POST";
request.data = ba;
request.contentType = "application/octet-stream";
navigateToURL(request, "_self");
}

//按像素读取控件
private function bitmapDataToByteArray(target : UIComponent):BitmapData
{
var imageWidth:uint = target.width;
var imageHeight:uint = target.height;
var srcBmp:BitmapData = new BitmapData( imageWidth, imageHeight );
srcBmp.draw(target);
return srcBmp;
}

//用来加载结果集数据
private function loadComplete(event:LoaderEvent):void
{
effectEvaluaChart.xmlConstructor = event.result as XML;
effectEvaluaChart.colorSeries = event.colorSeriesArray;
effectEvaluaChart.tips = BIChart.TIPS_SHOW;
effectEvaluaChart.reload();
}

//用户点击该图形时调用
private function doClick(event:BIChartEvent):void{

//var lineChartItem:LineSeriesItem = LineSeriesItem(event.hitData.chartItem);
/* Alert.show(lineChartItem.xValue.toString());
Alert.show(lineChartItem.yFilter.toString()); */
trace(event.dimensionField);
}
]]>
</mx:Script>
<companyname:LineChart width="100%" height="100%" id="effectEvaluaChart" fontSize="10"/>
</mx:Application>

xxxxxx.java
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值