说明:在a.mxml中点击链接按钮,跳转到b.jsp页面,b.jsp页面引用编译完成的c.swf文件,将参数通过b.jsp传递到c.swf文件中。
a.mxml:
protected function showToptenClick(event:MouseEvent):void {
//Alert.show("city="+rlink.cityId.text);
var url:String = Constants.webroot+"/manager/rlink.jsp?cityID="+rlink.cityId.text+"&cityName="+rlink.cityname.text;
//Alert.show(url);
var req:URLRequest = new URLRequest(url);
req.method = URLRequestMethod.POST;
navigateToURL(req,"_self");
}
b.jsp页面代码:
<%@page contentType="text/html; charset=utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>数据监控</title>
<script language="javascript"
src="<%=request.getContextPath()%>/js/dateChooser.js"></script>
<script src="<%=request.getContextPath()%>/js/prototype.js"></script>
<link rel="stylesheet" type="text/css"
href="<%=request.getContextPath()%>/css/main.css" />
</head>
<body>
<div class="table_main">
<div class="table_head"><span><var>
<p class="tb_004">数据监控</p>
</var> </span></div>
<div class="table_c_left">
<div class="table_c_right">
<div class="table_content">
<table width="94%" height="100%" border="0" cellpadding="0" cellspacing="0"
bordercolor="#999999" align="center">
<tr>
<td width="100%" height="100%">
<!--
<embed
src="<%=request.getContextPath()%>/flex/test.swf"
quality="high" bgcolor="#869ca7" width="100%" height="100%"
name="monitors" align="middle" play="true" loop="false"
quality="high" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
-->
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%" id="rlinktopten">
<param name="movie" value="<%=request.getContextPath()%>/flex/test.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#98dbf6" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<param name="flashvars" value="CITYID=<%= request.getParameter("cityID") %>&CITYNAME=<%= new String(request.getParameter("cityName").getBytes("ISO8859-1"),"GBK") %>"/>
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="<%=request.getContextPath()%>/flex/test.swf" width="100%" height="100%">
<param name="quality" value="high" />
<param name="bgcolor" value="#98dbf6" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--<![endif]-->
<!--[if gte IE 6]>-->
<p>
Either scripts and active content are not permitted to run or Adobe Flash Player version
10.0.0 or greater is not installed.
</p>
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="table_footer">
<div class="table_f_left">
<div class="table_f_right"></div>
</div>
</div>
</div>
</body>
</html>
flex4 代码:
c.swf
var params:Object = FlexGlobals.topLevelApplication.parameters;
var cityID:String = params.CITYID;
var cityName:String = params.CITYNAME;