`
jimphei
  • 浏览: 40516 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
社区版块
存档分类
最新评论

Flex初探

    博客分类:
  • Flex
阅读更多

最近在做一个工资统计模块,之前用了一个叫amchart
 的flash组件,感觉还是挺不错的,使用的效果如下,

后来又要实现一个明细的页面,心想已经用了flash技术了,干脆把flex技术也搞上,于是安装了flex builder,现学现用,

花了些时间, 做了个效果图,如下

 这里就只附上flex的代码,关于amchart,大家就自己google一下吧,

flex代码如下

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
xmlns="*" applicationComplete="send_data()">
    <mx:Script>
        <![CDATA[
        	import mx.rpc.events.ResultEvent;
        	import mx.rpc.http.HTTPService;
        	import mx.controls.Alert;
        	private var service:HTTPService=new HTTPService();
            private function send_data():void {
            	
				service.url="http://192.168.1.190/wage/services.php?month="+this.parameters.month+"&team="+encodeURI(this.parameters.team);
				service.useProxy=false;
				service.method="post";
				Alert.show(this.parameters.month+"  "+this.parameters.team+" "+service.url);
            	service.send();  
            }
        ]]>
    </mx:Script>
    <mx:DataGrid id="dataResult" dataProvider="{service.lastResult.wages.mem}" horizontalCenter="-38" verticalCenter="11" width="900" height="500">
        <mx:columns>
            <mx:DataGridColumn headerText="姓名" dataField="xm"/>
            <mx:DataGridColumn headerText="加班补贴" dataField="jbbt"/>
			<mx:DataGridColumn headerText="请假" dataField="qj"/>
            <mx:DataGridColumn headerText="扣款" dataField="kk"/>
            <mx:DataGridColumn headerText="住宿" dataField="sz"/>
            <mx:DataGridColumn headerText="满勤" dataField="mq"/>
            <mx:DataGridColumn headerText="社保" dataField="sb"/>
            <mx:DataGridColumn headerText="工龄" dataField="gl"/>
            <mx:DataGridColumn headerText="其他补贴" dataField="bt"/>
            <mx:DataGridColumn headerText="卡号" dataField="kh"/>
        </mx:columns>
    </mx:DataGrid>

</mx:Application>

 flex builder对应自动生成的html,为实现html传参,需做些修改,代码如下

<!-- saved from url=(0014)about:internet -->
<html lang="en">

<!-- 
Smart developers always View Source. 

This application was built using Adobe Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops via Adobe AIR. 

Learn more about Flex at http://flex.org 
// -->

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!--  BEGIN Browser History required section -->
<link rel="stylesheet" type="text/css" href="history/history.css" />
<!--  END Browser History required section -->

<title></title>
<script src="AC_OETags.js" language="javascript"></script>

<!--  BEGIN Browser History required section -->
<script src="history/history.js" language="javascript"></script>
<!--  END Browser History required section -->

<style>
body { margin: 0px; overflow:hidden }
</style>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 124;
// -----------------------------------------------------------------------------
// -->

//注:这个是重点,用于实现html传参
function getparafromurl() {
var url,pos,parastr,para;
url = window.location.href;
pos = url.indexOf("?")
parastr = url.substring(pos+1);
return parastr;
}
</script>
</head>

<body scroll="no">
<script language="JavaScript" type="text/javascript">
<!--
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);

// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

if ( hasProductInstall && !hasRequestedVersion ) {
	// DO NOT MODIFY THE FOLLOWING FOUR LINES
	// Location visited after installation is complete if installation is required
	var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
	var MMredirectURL = window.location;
    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
    var MMdoctitle = document.title;

	AC_FL_RunContent(
		"src", "playerProductInstall",
		"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
		"width", "100%",
		"height", "100%",
		"align", "middle",
		"id", "fourFlex",
		"quality", "high",
		"bgcolor", "#869ca7",
		"name", "fourFlex",
		"allowScriptAccess","sameDomain",
		"type", "application/x-shockwave-flash",
		"pluginspage", "http://www.adobe.com/go/getflashplayer",
		//为保证flex能接受到html参数,需加如下语句
		"FlashVars", getparafromurl()
	);
} else if (hasRequestedVersion) {
	// if we've detected an acceptable version
	// embed the Flash Content SWF when all tests are passed
	AC_FL_RunContent(
			"src", "fourFlex",
			"width", "100%",
			"height", "100%",
			"align", "middle",
			"id", "fourFlex",
			"quality", "high",
			"bgcolor", "#869ca7",
			"name", "fourFlex",
			"allowScriptAccess","sameDomain",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer",
			//为保证flex能接受到html参数,需加如下语句
			"FlashVars", getparafromurl()
	);
  } else {  // flash is too old or we can't detect the plugin
    var alternateContent = 'Alternate HTML content should be placed here. '
  	+ 'This content requires the Adobe Flash Player. '
   	+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
    document.write(alternateContent);  // insert non-flash content
  }
// -->
</script>
<noscript>
  	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fourFlex" width="100%" height="100%"
			codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
			<param name="movie" value="fourFlex.swf" />
			<param name="quality" value="high" />
			<param name="bgcolor" value="#869ca7" />
			<param name="allowScriptAccess" value="sameDomain" />
			<embed src="fourFlex.swf" quality="high" bgcolor="#869ca7"
				width="100%" height="100%" name="fourFlex" align="middle"
				play="true"
				loop="false"
				quality="high"
				allowScriptAccess="sameDomain"
				type="application/x-shockwave-flash"
				pluginspage="http://www.adobe.com/go/getflashplayer">
			</embed>
	</object>
</noscript>
</body>
</html>

 services.php:

require_once("db_class.php");
$db=new mysql("127.0.0.1","root","1234","wage","conn","utf8");
$month=$_REQUEST['month'];
$team_name=urldecode($_REQUEST['team']);

$sql="select xm,jbbt,qj,kk,sz,fk,mq,sb,gl,bt,kh,team from wage_detail where month=$month and team='$team_name'";


$arr=$db->fetchrows($sql);

$doc = new DOMDocument('1.0','utf-8');
$doc->formatOutput = true;
$r = $doc->createElement( "wages" );
$doc->appendChild( $r );

foreach( $arr as $user )
{
$mem = $doc->createElement( "mem" );

$xm = $doc->createElement( "xm" );
$xm->appendChild(
$doc->createTextNode( $user['xm'] )
);
$mem->appendChild( $xm );

$jbbt = $doc->createElement( "jbbt" );
$jbbt->appendChild(
$doc->createTextNode( $user['jbbt'] )
);
$mem->appendChild( $jbbt );

$qj= $doc->createElement( "qj" );
$qj->appendChild(
$doc->createTextNode( $user['qj'] )
);
$mem->appendChild( $qj );

$kk = $doc->createElement( "kk" );
$kk->appendChild(
$doc->createTextNode( $user['kk'] )
);
$mem->appendChild( $kk );

$sz = $doc->createElement( "sz" );
$sz->appendChild(
$doc->createTextNode( $user['sz'] )
);
$mem->appendChild( $sz );



$mq = $doc->createElement( "mq" );
$mq->appendChild(
$doc->createTextNode( $user['mq'] )
);
$mem->appendChild( $mq );

$sb = $doc->createElement( "sb" );
$sb->appendChild(
$doc->createTextNode( $user['sb'] )
);
$mem->appendChild( $sb );

$gl = $doc->createElement( "gl" );
$gl->appendChild(
$doc->createTextNode( $user['gl'] )
);
$mem->appendChild( $gl );

$bt = $doc->createElement( "bt" );
$bt->appendChild(
$doc->createTextNode( $user['bt'] )
);
$mem->appendChild( $bt );

$kh = $doc->createElement( "kh" );
$kh->appendChild(
$doc->createTextNode( $user['kh'] )
);
$mem->appendChild( $kh );

$r->appendChild( $mem );
}

echo $doc->saveXML();
?>

 

  • 大小: 38 KB
  • 大小: 59.1 KB
分享到:
评论

相关推荐

    marlett_01_0109.pdf

    marlett_01_0109

    [AB PLC例程源码][MMS_040384]Winder Application.zip

    AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!

    stassar_3cd_01_0716.pdf

    stassar_3cd_01_0716

    malpass_02_0907.pdf

    malpass_02_0907

    [AB PLC例程源码][MMS_046459]InView on EtherNet Add On Instruction.zip

    AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!

    matlab程序代码项目案例:matlab程序代码项目案例文档+程序具有输出LC滤波器的三相逆变器的前馈神经网络模型预测控制.zip

    matlab程序代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!

    matlab程序代码项目案例:matlab程序代码项目案例基于运动学车辆模型的开放式驾驶MPC横向控制算法.zip

    matlab程序代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!

    matsumoto_01_1107.pdf

    matsumoto_01_1107

    [AB PLC例程源码][MMS_045719]Rotary Knife with SoftLogix.zip

    AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!

    QT第五课-QT系统相关-文件

    代码

    大模型创业者手册-法务与产品合规篇.pdf

    大模型创业者手册-法务与产品合规篇.pdf

    [AB PLC例程源码][MMS_046456]ME Equipment Status Summary Faceplate for PowerFlex, Kinetix, E3 Plus,.zip

    AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!

    指标体系数据开发.pptx

    指标体系数据开发

    半导体三极管β值测量仪的设计与制作

    半导体三极管β值测量仪的设计与制作

    [AB PLC例程源码][MMS_047416]ME Faceplates-AOIs for GuardLogix Safety Systems.zip

    AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!

    [AB PLC例程源码][MMS_041473]Input Time Stamping.zip

    AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!

    本文将带你深入了解如何使用OpenCV库实现图片拼接技术,打造令人惊叹的全景图像。通过清晰的步骤讲解和代码示例

    本文将带你深入了解如何使用OpenCV库实现图片拼接技术,打造令人惊叹的全景图像。通过清晰的步骤讲解和代码示例

    nicholl_01_0508.pdf

    nicholl_01_0508

    lim_3ck_04_0719.pdf

    lim_3ck_04_0719

    DeepSeek入门宝典-个人使用篇.pdf

    DeepSeek入门宝典-个人使用篇.pdf

Global site tag (gtag.js) - Google Analytics