<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex the world</title>
	<atom:link href="http://www.flextheworld.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.flextheworld.com</link>
	<description>Flex, AIR, FMS, P2P and Things......</description>
	<lastBuildDate>Tue, 09 Mar 2010 02:07:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>招聘 &#8212; QTP (Flex Project)，Silverlight</title>
		<link>http://www.flextheworld.com/2010/03/qtp-silverlight-required.html</link>
		<comments>http://www.flextheworld.com/2010/03/qtp-silverlight-required.html#comments</comments>
		<pubDate>Tue, 09 Mar 2010 02:05:25 +0000</pubDate>
		<dc:creator>Kevin Luo</dc:creator>
				<category><![CDATA[新闻]]></category>
		<category><![CDATA[qtp]]></category>
		<category><![CDATA[silverlight]]></category>

		<guid isPermaLink="false">http://www.flextheworld.com/?p=716</guid>
		<description><![CDATA[成都深龙软件有限公司由加拿大外商于2005年夏天在成都高新区孵化园创办。主要从事软件外包服务业务。我们的顾客来自美国，加拿大和台湾。我们的外包业务主要是软件产品开发和实施全过程：需求分析，软件设计，软件开发，软件质量检测，和软件维护和支持。深龙软件经过过去几年的创办、磨炼、调整、发展艰难过程，公司基本在中国的北美外包产业迈开了第一步，形成了自己独特的一整套外包业务流程和规范，培养一批英语沟通熟练的技术骨干。最近公司和几家美国公司签约了长期合作协议，将承担大量的软件开发业务。因此公司急需一批能力强，经验丰富，英语流畅，敢于挑战的开发人员和管理人员。
.NET (Silverlight/C#) 高级软件工程师
职位概括参与深龙软件和加拿大公司合作开发、设计的仓库管理ERP软件。利用微软的最新.NET 3.5和即将推出的.NET 4.0平台和Silverlight技术，把传统的软件体系改善成为与互联网有机结合的SaaS模式。我们急需两名在.NET，尤其是Silverlight/WPF，有多年丰富经验的中级以上的软件工程师和架构师。任职资格 1、 计算机或相关专业本科学历；2、 5年以上.NET/C#/ASP.ENT工作经验；有几年大型企业软件开发设计经验。优先考虑ERP开发经验；3、 3年以上Silverlight/WPF工作经验。有网络企业软件（基于Web2.0，SaaS，RIA）经验优先；4、 较强的语言表达能力和文档撰写能力，良好的英文阅读书写能力；5、 熟悉构造网页网站的基本技能和原理，具有网页或者界面美工设计的能力；6、 较强的发现问题，分析问题的能力；7、 工作责任心强，细致，耐心；8、 熟悉SQL语言和SqlServer 2008数据库操作和使用。对数据结构的关系、理论，有着深刻的理解和实践；9、极强的团队协作精神、优秀的学习能力与创新能力，工作认真，态度端正；


QTP自动化测试高级工程师（急聘）
岗位职责 
1、 制定、编写软件测试方案与计划；2、 根据测试计划，使用HP Quick Test Pro (QTP) 编写自动测试程序；3、 每日运行测试程序，检查测试结果，编写测试报告，提交测试结果；4、 测试环境的设计、设置，完善测试规范流程、创建和维护测试用例；5、 改进软件测试流程、工具、和质量。6、 参与测试结果评审； 任职资格 
1、 计算机或相关专业本科学历；2、 3年以上自动化测试工作经验；有几年大型软件手动测试经验也可以考虑；3、 熟练编写QTP（或者其他）测试脚本，熟练操作和使用QTP开发环境，熟悉QTP开发语言VB；4、 了解软件工程学思想和方法，了解基本数据库系统及网络知识；5、 较强的发现问题，分析问题的能力；6、 较强的语言表达能力和文档撰写能力，良好的英文阅读书写能力；7、 工作责任心强，细致，耐心；8、 其他自动化测试脚本（例如WinRunner）经验或大型自动化测试工具使用经验者优先；9、 熟悉SQL和Oracle数据库系统优先；10、熟悉VB, Flex/AIR, Java, C#, C++开发环境和编程工具优先；
工作地点在成都，有兴趣的朋友请与我联系：
kevin.luo@siloon.com


]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.siloon.com">成都深龙软件有限公司</a>由加拿大外商于2005年夏天在成都高新区孵化园创办。主要从事软件外包服务业务。我们的顾客来自美国，加拿大和台湾。我们的外包业务主要是软件产品开发和实施全过程：需求分析，软件设计，软件开发，软件质量检测，和软件维护和支持。深龙软件经过过去几年的创办、磨炼、调整、发展艰难过程，公司基本在中国的北美外包产业迈开了第一步，形成了自己独特的一整套外包业务流程和规范，培养一批英语沟通熟练的技术骨干。最近公司和几家美国公司签约了长期合作协议，将承担大量的软件开发业务。因此公司急需一批能力强，经验丰富，英语流畅，敢于挑战的开发人员和管理人员。</p>
<h1 style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-size: 16px; color: #001999; word-break: break-all; padding: 0px;"><span id="lblJobName" style="padding: 0px; margin: 0px;">.NET (Silverlight/C#) 高级软件工程师</span></h1>
<p><span style="line-height: 24px; font-weight: bold; font-size: small; padding: 0px; margin: 0px;"><span style="line-height: 24px; font-family: 宋体; padding: 0px; margin: 0px;">职位概括</span></span><br style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" /><br style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" /><span style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;">参与深龙软件和加拿大公司合作开发、设计的仓库管理ERP软件。利用微软的最新.NET 3.5和即将推出的.NET 4.0平台和Silverlight技术，把传统的软件体系改善成为与互联网有机结合的SaaS模式。我们急需两名在.NET，尤其是Silverlight/WPF，有多年丰富经验的中级以上的软件工程师和架构师。</span><br style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" /><br style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" /><span style="line-height: 24px; font-weight: bold; font-size: small; padding: 0px; margin: 0px;"><span style="line-height: 24px; font-family: 宋体; padding: 0px; margin: 0px;"><strong>任职资格 </strong></span></span><br style="line-height: 18px; padding: 0px; margin: 0px;" /><br style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" /><span style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;">1、 计算机或相关专业本科学历；</span><br style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" /><span style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;">2、 5年以上.NET/C#/ASP.ENT工作经验；有几年大型企业软件开发设计经验。优先考虑ERP开发经验；</span><br style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" /><span style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;">3、 3年以上Silverlight/WPF工作经验。有网络企业软件（基于Web2.0，SaaS，RIA）经验优先；</span><br style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" /><span style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;">4、 较强的语言表达能力和文档撰写能力，良好的英文阅读书写能力；</span><br style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" /><span style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;">5、 熟悉构造网页网站的基本技能和原理，具有网页或者界面美工设计的能力；</span><br style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" /><span style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;">6、 较强的发现问题，分析问题的能力；</span><br style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" /><span style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;">7、 工作责任心强，细致，耐心；</span><br style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" /><span style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;">8、 熟悉SQL语言和SqlServer 2008数据库操作和使用。对数据结构的关系、理论，有着深刻的理解和实践；</span><br style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" /><span style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" lang="zh-CN">9、极强的团队协作精神、优秀的学习能力与创新能力，工作认真，态度端正；</span></p>
<p><span style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" lang="zh-CN"><br />
</span></p>
<h1 style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-size: 16px; color: #001999; word-break: break-all; padding: 0px;"><span id="lblJobName" style="padding: 0px; margin: 0px;">QTP自动化测试高级工程师（急聘）</span></h1>
<p><span style="padding: 0px; margin: 0px;"><strong>岗位职责 </strong></span></p>
<p><span style="padding: 0px; margin: 0px;">1、 制定、编写软件测试方案与计划；<br style="line-height: 18px; padding: 0px; margin: 0px;" />2、 根据测试计划，使用HP Quick Test Pro (QTP) 编写自动测试程序；<br style="line-height: 18px; padding: 0px; margin: 0px;" />3、 每日运行测试程序，检查测试结果，编写测试报告，提交测试结果；<br style="line-height: 18px; padding: 0px; margin: 0px;" />4、 测试环境的设计、设置，完善测试规范流程、创建和维护测试用例；<br style="line-height: 18px; padding: 0px; margin: 0px;" />5、 改进软件测试流程、工具、和质量。<br style="line-height: 18px; padding: 0px; margin: 0px;" />6、 参与测试结果评审； <br style="line-height: 18px; padding: 0px; margin: 0px;" /><br style="line-height: 18px; padding: 0px; margin: 0px;" /><strong>任职资格</strong> </span></p>
<p><span style="padding: 0px; margin: 0px;">1、 计算机或相关专业本科学历；<br style="line-height: 18px; padding: 0px; margin: 0px;" />2、 3年以上自动化测试工作经验；有几年大型软件手动测试经验也可以考虑；<br style="line-height: 18px; padding: 0px; margin: 0px;" />3、 熟练编写QTP（或者其他）测试脚本，熟练操作和使用QTP开发环境，熟悉QTP开发语言VB；<br style="line-height: 18px; padding: 0px; margin: 0px;" />4、 了解软件工程学思想和方法，了解基本数据库系统及网络知识；<br style="line-height: 18px; padding: 0px; margin: 0px;" />5、 较强的发现问题，分析问题的能力；<br style="line-height: 18px; padding: 0px; margin: 0px;" />6、 较强的语言表达能力和文档撰写能力，良好的英文阅读书写能力；<br style="line-height: 18px; padding: 0px; margin: 0px;" />7、 工作责任心强，细致，耐心；<br style="line-height: 18px; padding: 0px; margin: 0px;" />8、 其他自动化测试脚本（例如WinRunner）经验或大型自动化测试工具使用经验者优先；<br style="line-height: 18px; padding: 0px; margin: 0px;" />9、 熟悉SQL和Oracle数据库系统优先；<br style="line-height: 18px; padding: 0px; margin: 0px;" />10、熟悉VB, Flex/AIR, Java, C#, C++开发环境和编程工具优先；</span></p>
<p>工作地点在成都，有兴趣的朋友请与我联系：</p>
<p>kevin.luo@siloon.com</p>
<p><span style="line-height: 18px; font-family: 宋体; padding: 0px; margin: 0px;" lang="zh-CN"><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flextheworld.com/2010/03/qtp-silverlight-required.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>寻求团队开发基于Adobe AIR的相册制作,印刷系统</title>
		<link>http://www.flextheworld.com/2010/03/printing-project-develop.html</link>
		<comments>http://www.flextheworld.com/2010/03/printing-project-develop.html#comments</comments>
		<pubDate>Thu, 04 Mar 2010 06:44:31 +0000</pubDate>
		<dc:creator>Kevin Luo</dc:creator>
				<category><![CDATA[我的事]]></category>

		<guid isPermaLink="false">http://www.flextheworld.com/?p=708</guid>
		<description><![CDATA[朋友的公司想要开发一个类似http://www.mycanvas.com的桌面版客户端，客户端的基本流程如下:
用户模式:

用户选择想要的相册产品，尺寸。
选择主题，进入相册编辑
编辑相册的过程中可以本地保存相册，可以随时打开编辑。
制作完成后生成PDF文档，文档上传服务器开始打印流程

管理员模式:

管理员可以制作，保存主题，保存的主题可以供普通用户客户端下载使用。

我们已经完成了项目的技术难点部分:

完成了相片的编辑控件，控件和Mycanvas的相片控件器用法相同（旋转，裁剪，缩放，滤镜，遮罩，边框等）。
文字控制器完成（对嵌入文字的粗体设置有bug）
大分辨率画布的设置
大分辨率PDF打印

你们可以在项目中使用该控件，对控件进行任意的修改，对控件不明白的地方，我们提供帮助。下面是控件Demo的截图。
照片控制器

文字控制器1

文字控制器2

这个控制器是我和我的团队年前帮朋友做的，但由于我时间的问题，现在不能再继续这个项目。现寻求团队（个人或者公司）对客户端进行开发，关于整个项目的体验，你可以直接尝试mycanvas.com. 我们和他的操作流程差不多。具体的需求我们谈过以后会提供给你。如果你有兴趣请用以下方式联系我。

Email: kevin.luo.sl@gmail.com (随时在线)
QQ: 10863511
MSN: kevin.luo.sl@hotmail.com

]]></description>
			<content:encoded><![CDATA[<p>朋友的公司想要开发一个类似<a href="http://www.mycanvas.com">http://www.mycanvas.com</a>的桌面版客户端，客户端的基本流程如下:</p>
<p><strong>用户模式:</strong></p>
<ol>
<li>用户选择想要的相册产品，尺寸。</li>
<li>选择主题，进入相册编辑</li>
<li>编辑相册的过程中可以本地保存相册，可以随时打开编辑。</li>
<li>制作完成后生成PDF文档，文档上传服务器开始打印流程</li>
</ol>
<p><strong>管理员模式:</strong></p>
<ol>
<li>管理员可以制作，保存主题，保存的主题可以供普通用户客户端下载使用。</li>
</ol>
<p><strong>我们已经完成了项目的技术难点部分:</strong></p>
<ol>
<li>完成了相片的编辑控件，控件和Mycanvas的相片控件器用法相同（旋转，裁剪，缩放，滤镜，遮罩，边框等）。</li>
<li>文字控制器完成（对嵌入文字的粗体设置有bug）</li>
<li>大分辨率画布的设置</li>
<li>大分辨率PDF打印</li>
</ol>
<p>你们可以在项目中使用该控件，对控件进行任意的修改，对控件不明白的地方，我们提供帮助。下面是控件Demo的截图。</p>
<p><strong>照片控制器</strong></p>
<p><img class="alignnone size-full wp-image-709" title="1" src="http://www.flextheworld.com/wp-content/uploads/2010/03/1.gif" alt="1" width="500" height="296" /></p>
<p><strong>文字控制器1</strong></p>
<p><img class="alignnone size-full wp-image-710" title="2" src="http://www.flextheworld.com/wp-content/uploads/2010/03/2.gif" alt="2" width="500" height="299" /></p>
<p><strong>文字控制器2</strong></p>
<p><img class="alignnone size-full wp-image-711" title="3" src="http://www.flextheworld.com/wp-content/uploads/2010/03/3.gif" alt="3" width="500" height="303" /></p>
<p>这个控制器是我和我的团队年前帮朋友做的，但由于我时间的问题，现在不能再继续这个项目。现寻求团队（个人或者公司）对客户端进行开发，关于整个项目的体验，你可以直接尝试mycanvas.com. 我们和他的操作流程差不多。具体的需求我们谈过以后会提供给你。如果你有兴趣请用以下方式联系我。</p>
<ol>
<li>Email: kevin.luo.sl@gmail.com (随时在线)</li>
<li>QQ: 10863511</li>
<li>MSN: kevin.luo.sl@hotmail.com</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.flextheworld.com/2010/03/printing-project-develop.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash player 与 HTML 5 视频播放CPU消耗对比评测</title>
		<link>http://www.flextheworld.com/2010/03/flash-html5-ipad.html</link>
		<comments>http://www.flextheworld.com/2010/03/flash-html5-ipad.html#comments</comments>
		<pubDate>Mon, 01 Mar 2010 05:36:18 +0000</pubDate>
		<dc:creator>Kevin Luo</dc:creator>
				<category><![CDATA[我的事]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[ipad]]></category>

		<guid isPermaLink="false">http://www.flextheworld.com/?p=701</guid>
		<description><![CDATA[今天看了Jan写的Flash Player: CPU Hog or Hot Tamale? It Depends. 有感而发，Jan的文章明显是回应水果老大乔布斯同志之前的关于Flash player是CPU杀手的言论发出的。也许还有个同学不知道事情的始末，我来简单说一下。
近期苹果发布了一款掌上电脑iPad, 但是作为一款电脑来说他不支持全球使用虑达9X.XX%的Flash Player。乔布斯一开始直说Adobe的人都太懒，Flash Player漏洞很多，等等等等。但后来乔布斯同志说他们之所以不用Flash是因为Flash太消耗CPU，如果ipad引入Flash Player, 他们的电池只能用1.5小时（不用的话号称10小时）所以他们选择了支持HTML 5 而放弃Flash，除此之外乔布斯还到处又说别人也不要使用Flash, 有传言说和苹果合作的纽约时报已经决定完全放弃Flash。
我们接着说Jan的这篇文章，这位Jan也是牛人，从1990年就开始从事视频相关工作，有13本关于视频方面的书出版。他的这篇文章很客观的指出了HTML5 与Flash Player 10/10.1在视频方面对CPU消耗的情况。还是毛XX说的好（我不清楚加上主席后我的博客会不会被河蟹，还是算了），实践是检验真理的最佳标准。
也许还有同学不了解HTML5, 简单说一下
HTML5是新的HTML标准，目前被最新的Safari, Chrome, IE8, FireFox 支持。HTML5中增加了许多新特性，例如嵌入音频、视频和图片的函数、客户端存 储数据、交互式文档等。HTML 5也是传说中要终结Flash Player的新标准。为什么需要终结Flash Player呢？理由很简单，Flash Player已经成为一种标准，但是他却是Adobe一家的产品，这怎么能行呢。于是HTML 5的产生是必须的。乔布斯同志说不用Flash Player而用HTML5是因为CPU问题，这个实验也证明了在苹果自己的系统上，HTML 5在Safrai上的效率确实要强过Flash 2被有余，但是在Windows 平台上，HTML 5 的效率却远远低于Flash Player。虽然如此，我觉得乔布斯通知不接受Flash Player根本原因还是他的App store。 iphone OS是一个平台，Flash 也是一个平台，乔布斯在ipad或者iphone中引入Flash, 无疑会对App Store造成非常大的冲击。Adobe和苹果也许永远也不可能成为合作关系，Flash平台和苹果App Store从根本上产生冲突。他们也许永远是对手!
Jan在以下环境对HTML 5和Adobe进行了测试
浏览器
windows:
- Apple Safari &#8211; 4.0.4 (531.21.10).
- Mozilla [...]]]></description>
			<content:encoded><![CDATA[<p>今天看了Jan写的<a href="http://www.streaminglearningcenter.com/articles/flash-player-cpu-hog-or-hot-tamale-it-depends-.html ">Flash Player: CPU Hog or Hot Tamale? It Depends</a>. 有感而发，Jan的文章明显是回应水果老大乔布斯同志之前的关于Flash player是CPU杀手的言论发出的。也许还有个同学不知道事情的始末，我来简单说一下。</p>
<p>近期苹果发布了一款掌上电脑iPad, 但是作为一款电脑来说他不支持全球使用虑达9X.XX%的Flash Player。乔布斯一开始直说Adobe的人都太懒，Flash Player漏洞很多，等等等等。但后来乔布斯同志说他们之所以不用Flash是因为Flash太消耗CPU，如果ipad引入Flash Player, 他们的电池只能用1.5小时（不用的话号称10小时）所以他们选择了支持HTML 5 而放弃Flash，除此之外乔布斯还到处又说别人也不要使用Flash, 有传言说和苹果合作的纽约时报已经决定完全放弃Flash。</p>
<p>我们接着说Jan的这篇文章，这位Jan也是牛人，从1990年就开始从事视频相关工作，有13本关于视频方面的书出版。他的这篇文章很客观的指出了HTML5 与Flash Player 10/10.1在视频方面对CPU消耗的情况。还是毛XX说的好（我不清楚加上主席后我的博客会不会被河蟹，还是算了），实践是检验真理的最佳标准。</p>
<p>也许还有同学不了解HTML5, 简单说一下</p>
<p>HTML5是新的HTML标准，目前被最新的Safari, Chrome, IE8, FireFox 支持。HTML5中增加了许多新特性，例如嵌入音频、视频和图片的函数、客户端存 储数据、交互式文档等。HTML 5也是传说中要终结Flash Player的新标准。为什么需要终结Flash Player呢？理由很简单，Flash Player已经成为一种标准，但是他却是Adobe一家的产品，这怎么能行呢。于是HTML 5的产生是必须的。乔布斯同志说不用Flash Player而用HTML5是因为CPU问题，这个实验也证明了在苹果自己的系统上，HTML 5在Safrai上的效率确实要强过Flash 2被有余，但是在Windows 平台上，HTML 5 的效率却远远低于Flash Player。虽然如此，我觉得乔布斯通知不接受Flash Player根本原因还是他的App store。 iphone OS是一个平台，Flash 也是一个平台，乔布斯在ipad或者iphone中引入Flash, 无疑会对App Store造成非常大的冲击。Adobe和苹果也许永远也不可能成为合作关系，Flash平台和苹果App Store从根本上产生冲突。他们也许永远是对手!</p>
<p>Jan在以下环境对HTML 5和Adobe进行了测试</p>
<h2><strong>浏览器</strong></h2>
<p><strong>windows:</strong></p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px;"><strong><em>- Apple Safari</em></strong> &#8211; 4.0.4 (531.21.10).</p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px;"><em><strong>- Mozilla Firefox</strong></em> &#8211; version 3.6</p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px;"><em><strong>- Google Chrome</strong></em> &#8211; 4.0.249.89</p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px;"><em><strong>- Microsoft Internet Explorer</strong></em> &#8211; 8.0.7600.16385</p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px;"><em><strong>- Adobe Flash Player</strong></em> &#8211; 10.0.45.2 first, then 10.1.51.95</p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; "><strong>Mac</strong></p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px;"><strong><em>- Apple Safari </em></strong>- 4.0.4 (6531.21.10,55180).</p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px;"><em><strong>- Mozilla Firefox</strong></em> &#8211; version 3.6</p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px;"><em><strong>- Google Chrome</strong></em> &#8211; 5.0.307.9 beta</p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 30px;"><em><strong>- Microsoft Internet Explorer</strong></em> &#8211; 8.0.7600.16385<br style="outline-style: none; outline-width: initial; outline-color: initial; padding: 0px; margin: 0px;" /><em><strong>- Adobe Flash Player </strong></em>- 10.0.45.2 first, then 10.1.51.95</p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px;">下面是对比结果</p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px;"><strong>windows:</strong></p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px;"><strong><img class="alignnone size-full wp-image-702" title="dc2hxh8z_308rgf7kxhg_b" src="http://www.flextheworld.com/wp-content/uploads/2010/03/dc2hxh8z_308rgf7kxhg_b.jpeg" alt="dc2hxh8z_308rgf7kxhg_b" width="791" height="129" /></strong></p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px;"><strong>Mac</strong></p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px;"><strong><img class="alignnone size-full wp-image-703" title="dc2hxh8z_305n7dc9whh_b" src="http://www.flextheworld.com/wp-content/uploads/2010/03/dc2hxh8z_305n7dc9whh_b.jpeg" alt="dc2hxh8z_305n7dc9whh_b" width="656" height="133" /></strong></p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px;">
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px;">我们可以看出，在Mac上，Flash Player在Safari上的表现确实不如HTML 5, 效率低了2倍，即使换上了Flash player 10.1. 还有有1.5倍的差距。由此看来乔布斯的说法还是有根据的。但除此之外Flash player的表现完全胜出HTML5, 当然这也许是由于其他浏览器对HTML 5的支持还有待提高。但Flash player在Windows平台上各种浏览器下的表现都是相当不错，尤其是Flash player 10.1，不知道这是否可以说明，如果是基于Windows平台的电脑，手机或者掌上电脑，Flash Player 还是浏览器视频播放的首选。</p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px;">
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px;">最后要说的是Flash player在Linux环境下的表现差也不是一天两天了，真希望这个情况在未来可以好转，我长期在Mac环境下开发Flex程序，这个问题确实是比较头疼。我支持Adobe，同时也是乔布斯通知的忠实粉丝。所以我决定HTML 5, Flex两手都要抓，两手都要硬！</p>
<p style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; outline-style: none; outline-width: initial; outline-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px;">
]]></content:encoded>
			<wfw:commentRss>http://www.flextheworld.com/2010/03/flash-html5-ipad.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Flex 迷你教程 &#8212; 基于Stratus 2的P2P在线视频共享1 (NetGroup, Multicast实例)</title>
		<link>http://www.flextheworld.com/2010/02/flex-stratus-2-p2p.html</link>
		<comments>http://www.flextheworld.com/2010/02/flex-stratus-2-p2p.html#comments</comments>
		<pubDate>Wed, 24 Feb 2010 08:46:29 +0000</pubDate>
		<dc:creator>Kevin Luo</dc:creator>
				<category><![CDATA[Flex 迷你教程]]></category>
		<category><![CDATA[P2P]]></category>
		<category><![CDATA[未分类]]></category>
		<category><![CDATA[flash player 10.1]]></category>
		<category><![CDATA[Stratus]]></category>

		<guid isPermaLink="false">http://www.flextheworld.com/?p=691</guid>
		<description><![CDATA[终于有时间试下Strtaus 2的p2p多播功能了。之前看的视频介绍中，Adobe描述一个非常理想的多人P2P数据共享方式。但是今天试了一下后发现视频的速度非常慢（视频的发布和接收端都在一台机器上），感觉上视频被发送到了什么地方后才传了回来。这这&#8230;&#8230;好吧，就当是BETA的问题了，WAIT AND SEE. (2/25日更新，2/23日发布的Flash player 10.1 beta 3 看来解决了这个问题，Demo的速度现在非常正常)
准备工作:
先了解一下什么是stratus以及什么是RTMFP，你可以到http://labs.adobe.com/technologies/stratus/看下官方的解释或者直接看我原来的 Flex 迷你教程 — 基于Stratus的P2P网络电话 (1)(2)(3) 先学习一下Flash p2p的基础. 简单的说原来的Stratus 实现了flash player之间点对点的传输数据，而今天要讲的stratus 2 不仅支持单个的点对点数据传说，还引入了多播的概念。
在原来的stratus中如果我们要做一个多人同时在线的应用，比如多人视频。那么我们需要把在线的所有人都链接起来，类似蜘蛛网的结构，网中的每个人需要与其他所有人链接，这样数据才能在所有人中共享。这种模式在多人连线中是不可取的。假设我们用户A发布一个视频想让其他10个用户观看，那么10个用户都需要链接到他。就中国的普通用户的网络带宽来说，这就是极限了。而Stratus 2 中 “组” 的概念解决了这个问题。用户A发布视频让同一个组中的其他10个人观看。他们并都从A处获取视频。而有可能通过组中的其他用户获取A的视频。这也就是P2P的模式了，每个人都可以作为数据的发出者，数据以最优的方式被观看者收到，参与的人越多，数据的副本就越多。视频的速度也就越快。


确定你安装了 Flex SDK3.2 以上的SDK (现在最新的是3.5). 这里下载
确定安装了flash payer 10.1 debug version (开发环境最好用debug version)  这里下载
申请一个 Stratus develper key 这里申请
下载flash player 10.1 的 Player Global SWC  这里下载，放到你的SDK3.2目录下面吧
导入下面的Demo源文件，编辑项目属性 — Flex compiler — Require Flash player version 到 10:1:0
编辑项目属性 [...]]]></description>
			<content:encoded><![CDATA[<p>终于有时间试下Strtaus 2的p2p多播功能了。之前看的视频介绍中，Adobe描述一个非常理想的多人P2P数据共享方式。但是今天试了一下后发现视频的速度非常慢（视频的发布和接收端都在一台机器上），感觉上视频被发送到了什么地方后才传了回来。这这&#8230;&#8230;好吧，就当是BETA的问题了，WAIT AND SEE. <strong><span style="color: #ff0000;">(2/25日更新，2/23日发布的Flash player 10.1 beta 3 看来解决了这个问题，Demo的速度现在非常正常)</span></strong></p>
<h2>准备工作:</h2>
<p><span style="font-weight: normal; font-size: 13px;">先了解一下什么是stratus以及什么是RTMFP，你可以到<a href="http://labs.adobe.com/technologies/stratus/">http://labs.adobe.com/technologies/stratus/</a>看下官方的解释或者直接看我原来的 <a href="http://www.flextheworld.com/2009/01/flex-stratus-p2p-phone.html">Flex 迷你教程 — 基于Stratus的P2P网络电话 (1)(2)(3</a>) 先学习一下Flash p2p的基础. 简单的说原来的Stratus 实现了flash player之间点对点的传输数据，而今天要讲的stratus 2 不仅支持单个的点对点数据传说，还引入了多播的概念。</span></p>
<p><span style="font-weight: normal; font-size: 13px;">在原来的stratus中如果我们要做一个多人同时在线的应用，比如多人视频。那么我们需要把在线的所有人都链接起来，类似蜘蛛网的结构，网中的每个人需要与其他所有人链接，这样数据才能在所有人中共享。这种模式在多人连线中是不可取的。假设我们用户A发布一个视频想让其他10个用户观看，那么10个用户都需要链接到他。就中国的普通用户的网络带宽来说，这就是极限了。而Stratus 2 中 “组” 的概念解决了这个问题。用户A发布视频让同一个组中的其他10个人观看。他们并都从A处获取视频。而有可能通过组中的其他用户获取A的视频。这也就是P2P的模式了，每个人都可以作为数据的发出者，数据以最优的方式被观看者收到，参与的人越多，数据的副本就越多。视频的速度也就越快。<span id="more-691"></span><br />
</span></p>
<ol>
<li>确定你安装了 Flex SDK3.2 以上的SDK (现在最新的是3.5). <a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #000000; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://www.adobe.com/products/flex/flexdownloads/" target="_blank">这里下载</a></li>
<li>确定安装了flash payer 10.1 debug version (开发环境最好用debug version)  <a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #000000; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://labs.adobe.com/downloads/flashplayer10.html" target="_blank">这里下载</a></li>
<li>申请一个 Stratus develper key <a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #000000; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" href="https://www.adobe.com/cfusion/entitlement/index.cfm?e=stratus" target="_blank">这里申请</a></li>
<li>下载flash player 10.1 的 Player Global SWC  <a href="http://download.macromedia.com/pub/labs/flashplayer10/flashplayer10_globalswc.zip">这里下载</a>，放到你的SDK3.2目录下面吧</li>
<li>导入下面的Demo源文件，编辑项目属性 — Flex compiler — Require Flash player version 到 10:1:0</li>
<li>编辑项目属性 &#8212; Flex Builder Path &#8212; Library Path &#8212; Add SWC. 添加你刚才下载的playerglobal.swc &#8212;- 添加后双击playerglobal.swc &#8212; 双击Link Type &#8212; 切换Link Type到External</li>
</ol>
<p>好了，准备工作到此结束。</p>
<h2><strong>Demo操作</strong></h2>
<p>Demo 是一个视频共享的程序，用户A发布一个视频，其他进入相同组的用户可以观看视频，观看视频的同时大家可以文字聊天</p>
<ol>
<li>先运行Publisher.mxml. 点击链接 （记住Group 名字，一会要用）</li>
<li>运行Viewer.mxml, 输入刚才的Group 名字，点链接。</li>
<li>你可以运行多个Viewer,输入相同的Group名，链接进去同一个组</li>
<li>链接成功后Viewer可以看见Publisher发布的视频。下面的聊天框可以和所有人聊天。</li>
</ol>
<h2><strong>代码说明</strong></h2>
<p>具体的代码说明大家下载源文件看注释就好了（看Publisher的注释）。这里只说一下Publisher和Viewer的区别，Publisher是作为视频的发布者以及Group的参与者（注意他并不是Gruop的&#8221;老大&#8221;，Group对这里的任何人来说都是平等的，Publisher只是在里面发布了视频而已）。Viewer是视频的接收者以及Group的参与者。下面的代码指出了Viewer和Publisher的不同</p>
<p><strong>Publisher发布视频</strong></p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p691code3'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6913"><td class="code" id="p691code3"><pre class="actionscript3" style="font-family:monospace;">           <span style="color: #3f5fbf;">/**
            *
            * NetStraeam链接到用户组后触发
            * */</span>
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onNetStreamConnect<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
            	<span style="color: #009900; font-style: italic;">//加载话筒</span>
                netStream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">client</span> = <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> mic<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=microphone%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:microphone.html"><span style="color: #004993;">Microphone</span></a> = <a href="http://www.google.com/search?q=microphone%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:microphone.html"><span style="color: #004993;">Microphone</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">getMicrophone</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>mic<span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    mic<span style="color: #000066; font-weight: bold;">.</span>codec = SoundCodec<span style="color: #000066; font-weight: bold;">.</span>SPEEX<span style="color: #000066; font-weight: bold;">;</span>
                    mic<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setSilenceLevel</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
                    netStream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">attachAudio</span><span style="color: #000000;">&#40;</span>mic<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
                    updateStatus<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;话筒设置完毕<span style="">\n</span>&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
                <span style="color: #009900; font-style: italic;">//加载视频，并发布视频和话筒</span>
                publishVideo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
            <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p><strong>Viewer接收视频</strong></p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p691code4'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6914"><td class="code" id="p691code4"><pre class="actionscript3" style="font-family:monospace;">            <span style="color: #3f5fbf;">/**
            *
            * NetStraeam链接到用户组后触发
            * */</span>
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> onNetStreamConnect<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
                netStream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">client</span> = <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
                <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000066; font-weight: bold;">!</span>= video<span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    videoDisplay<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">removeChild</span><span style="color: #000000;">&#40;</span>video<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    video = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
&nbsp;
                video = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=video%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:video.html"><span style="color: #004993;">Video</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                video<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">smoothing</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000066; font-weight: bold;">;</span>
                video<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">attachNetStream</span><span style="color: #000000;">&#40;</span>netStream<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                videoDisplay<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>video<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
                <span style="color: #009900; font-style: italic;">//播放视频</span>
                netStream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">play</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;stream&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                netStream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">bufferTime</span> = <span style="color: #000000; font-weight:bold;">1.0</span><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<h2>Demo截图</h2>
<p><strong>Publisher</strong></p>
<p><img class="alignnone size-full wp-image-694" title="a" src="http://www.flextheworld.com/wp-content/uploads/2010/02/a.png" alt="a" width="641" height="498" /></p>
<p><strong>Viewer</strong></p>
<p><img class="alignnone size-full wp-image-695" title="b" src="http://www.flextheworld.com/wp-content/uploads/2010/02/b.png" alt="b" width="642" height="547" /></p>
<h2>源代码下载</h2>
<a class="downloadlink" href="http://www.flextheworld.com/wp-content/plugins/download-monitor/download.php?id=24" title=" downloaded 35 times" >Stratus2Demo (35)</a>
]]></content:encoded>
			<wfw:commentRss>http://www.flextheworld.com/2010/02/flex-stratus-2-p2p.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Adobe AIR 2 beta 2 放出</title>
		<link>http://www.flextheworld.com/2010/02/adobe-air-2-beta-2.html</link>
		<comments>http://www.flextheworld.com/2010/02/adobe-air-2-beta-2.html#comments</comments>
		<pubDate>Wed, 10 Feb 2010 01:34:46 +0000</pubDate>
		<dc:creator>Kevin Luo</dc:creator>
				<category><![CDATA[新闻]]></category>
		<category><![CDATA[AIR 2.0]]></category>

		<guid isPermaLink="false">http://www.flextheworld.com/?p=688</guid>
		<description><![CDATA[2010年的2月2日，Adobe发布了AIR 2 beta 2. 由于当前的一个项目需要操作到硬件，所以早早的使用的AIR 2 beta 1进行开发。不过也确实体验到了Beta 1 中Bug的厉害。
1. 在1.5 中运行很好的程序刚换上AIR 2并打包成exe后，立马在退出程序时导致windows爆出程序关闭异常。
2. 在1.5中运行得很好的数据库操作部分(transaction)，在AIR 2中出了莫名其妙的错误。找不到具体原因。只有暂时放弃它的transation, 改用了自己的代替。在正式版发布后再替换回来吧只有。
此次AIR 2 beta 2的更新包括
1. 打印增强。
2. TTL/SSL sokcets.
3. 等等
详细信息请看这里 http://labs.adobe.com/wiki/index.php/AIR_2:Release_Notes
]]></description>
			<content:encoded><![CDATA[<p>2010年的2月2日，Adobe发布了AIR 2 beta 2. 由于当前的一个项目需要操作到硬件，所以早早的使用的AIR 2 beta 1进行开发。不过也确实体验到了Beta 1 中Bug的厉害。</p>
<p>1. 在1.5 中运行很好的程序刚换上AIR 2并打包成exe后，立马在退出程序时导致windows爆出程序关闭异常。<br />
2. 在1.5中运行得很好的数据库操作部分(transaction)，在AIR 2中出了莫名其妙的错误。找不到具体原因。只有暂时放弃它的transation, 改用了自己的代替。在正式版发布后再替换回来吧只有。</p>
<p>此次AIR 2 beta 2的更新包括</p>
<p>1. 打印增强。<br />
2. TTL/SSL sokcets.<br />
3. 等等</p>
<p>详细信息请看这里 http://labs.adobe.com/wiki/index.php/AIR_2:Release_Notes</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flextheworld.com/2010/02/adobe-air-2-beta-2.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPad</title>
		<link>http://www.flextheworld.com/2010/01/ipad.html</link>
		<comments>http://www.flextheworld.com/2010/01/ipad.html#comments</comments>
		<pubDate>Wed, 27 Jan 2010 10:20:01 +0000</pubDate>
		<dc:creator>Kevin Luo</dc:creator>
				<category><![CDATA[我的事]]></category>
		<category><![CDATA[Apple]]></category>

		<guid isPermaLink="false">http://www.flextheworld.com/?p=682</guid>
		<description><![CDATA[这个和Flex没什么关系，凌晨是Apple的一年一度的发布会，很激动。
谁能捐钱给我买平板电脑，我接受任何形式的捐赠，哈哈&#8230;&#8230;..
]]></description>
			<content:encoded><![CDATA[<p>这个和Flex没什么关系，凌晨是Apple的一年一度的发布会，很激动。</p>
<p>谁能捐钱给我买平板电脑，我接受任何形式的捐赠，哈哈&#8230;&#8230;..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flextheworld.com/2010/01/ipad.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Stratus 服务升级，完全支持RTFMP Groups以及P2P多播</title>
		<link>http://www.flextheworld.com/2010/01/stratus-group-p2p.html</link>
		<comments>http://www.flextheworld.com/2010/01/stratus-group-p2p.html#comments</comments>
		<pubDate>Sat, 23 Jan 2010 13:24:58 +0000</pubDate>
		<dc:creator>Kevin Luo</dc:creator>
				<category><![CDATA[P2P]]></category>
		<category><![CDATA[flash multicast]]></category>
		<category><![CDATA[Stratus]]></category>

		<guid isPermaLink="false">http://www.flextheworld.com/?p=680</guid>
		<description><![CDATA[太激动了，等这天等了好久了，Adobe 2008年发布了Stratus服务器的Beta版，支持flash player之间的点对点链接，今天，Adobe再次更新Status服务，这一更新也使Flash真正进入P2P的世界。现在Adobe的例子还没有出来，感兴趣的朋友可以关注以下几个地方 (引自 http://www.flashrealtime.com/updated-stratus-with-groups-and-multicast/):
- Read more about new Stratus here at Kevin’s blog.
- Also check new Labs page about RTMFP Groups.
- My article about Multicast in Flash Player 10.1
- Read about differences between Stratus and LCCS
]]></description>
			<content:encoded><![CDATA[<p>太激动了，等这天等了好久了，Adobe 2008年发布了Stratus服务器的Beta版，支持flash player之间的点对点链接，今天，Adobe再次更新Status服务，这一更新也使Flash真正进入P2P的世界。现在Adobe的例子还没有出来，感兴趣的朋友可以关注以下几个地方 (引自 http://www.flashrealtime.com/updated-stratus-with-groups-and-multicast/):</p>
<p>- Read more about new Stratus <a style="padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-style: inherit; font-family: inherit; color: #cb0100; text-decoration: none; border-bottom-style: solid; border-bottom-color: #dddddd; margin: 0px;" onclick="javascript:pageTracker._trackPageview ('/outbound/blogs.adobe.com');" href="http://blogs.adobe.com/ktowes/2010/01/rtmfp_groups_multicast_now_ava.html">here at Kevin’s blog</a>.<br />
- Also check <a style="padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-style: inherit; font-family: inherit; color: #cb0100; text-decoration: none; border-bottom-style: solid; border-bottom-color: #dddddd; margin: 0px;" onclick="javascript:pageTracker._trackPageview ('/outbound/labs.adobe.com');" href="http://labs.adobe.com/technologies/stratus/rtmfpgroups.html">new Labs page about RTMFP Groups</a>.<br />
- <a style="padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-style: inherit; font-family: inherit; color: #cb0100; text-decoration: none; border-bottom-style: solid; border-bottom-color: #dddddd; margin: 0px;" href="http://www.flashrealtime.com/peer-to-peer-multicast-in-new-flash-player-101/">My article</a> about Multicast in Flash Player 10.1<br />
- <a style="padding-top: 0px; padding-right: 0px; padding-bottom: 1px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-style: inherit; font-family: inherit; color: #cb0100; text-decoration: none; border-bottom-style: solid; border-bottom-color: #dddddd; margin: 0px;" onclick="javascript:pageTracker._trackPageview ('/outbound/www.adobe.com');" href="http://www.adobe.com/devnet/flashmediaserver/articles/p2p_apps_stratus_lccs.html)">Read about differences between Stratus and LCCS</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flextheworld.com/2010/01/stratus-group-p2p.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AIR 迷你教程 — 在AIR 2.0 程序中嵌入TOMCAT（NativeProcess 实例）</title>
		<link>http://www.flextheworld.com/2010/01/air-2-tomcat-nativeprocess.html</link>
		<comments>http://www.flextheworld.com/2010/01/air-2-tomcat-nativeprocess.html#comments</comments>
		<pubDate>Thu, 21 Jan 2010 06:04:05 +0000</pubDate>
		<dc:creator>Kevin Luo</dc:creator>
				<category><![CDATA[AIR 迷你教程]]></category>
		<category><![CDATA[AIR 2.0]]></category>

		<guid isPermaLink="false">http://www.flextheworld.com/?p=670</guid>
		<description><![CDATA[AIR 2.0 有很多令人期待和振奋的功能，使得AIR向成熟的桌面应用程序开发环境又进了一大步。上一篇文章里介绍了ServerSocket的用法，这篇教程中将向大家介绍NativeProcess，在AIR2.0中我们可以使用程序默认的打开方式直接打开一个外部的应用程序 (file.openWithDefaultApplication()) 或者 通过今天要讲的启动进程方式运行一个程序。
AIR与本地应用程序的交互是AIR 2.0的一个重要更新，这个功能的实现可以帮助我们做到在AIR 1.5时代很难完成的事情，比如我在项目中就需要操作一些硬件，但AIR不能直接操作端口，所以只能借助其他的小程序来实现，现在我们就可以很容易的操作这些小程序以达到操作硬件的目的，而Flex (AIR)与JAVA的结合很早就已经开始了，但由于早期AIR的局限性，想要把JAVA直接部署在客户端还是比较麻烦的事情，但是从AIR2.0开始我们不用担心了。现在我们用很简单的方式就可以在AIR程序中集成TOMCAT, 一次性的将后台与AIR部署到客户端。
程序的原版（Flash Builder 4版）同样是从http://coenraets.org/获得，有兴趣的朋友可以关注这个博客。我的例子仍然使用FLEX 3.
Demo过程

下载安装 AIR 2.0 beta runtime.
下载AIRAppWithEmbeddedTomcat..exe 或者 AIRAppWithEmbeddedTomcat.dmg (NativeProcess 必须在程序发布为相应平台的应用程序后才可以使用，发布的方法这里就不介绍了，可以参看http://help.adobe.com/en_US/FlashPlatform/develop/air/building_apps/WS789ea67d3e73a8b22388411123785d839c-8000.html)
安装运行AIRAppWithEmbeddedTomcat.exe, 修改JAVA_HOME，如果默认的路径不对
点击 &#8220;启动&#8221; 可以开启TOMCAT(端口是8080)。在JSP实例和RemoteObject实例中可以看见加载JSP页面和使用RemoteObject获取数据的测试。


控制台
 

JSP 加载测试

RemoteObject 测试

源代码

?View Code ACTIONSCRIPT3&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;!--www.flextheworld.com--&#62;
&#60;mx:WindowedApplication applicationComplete=&#34;init()&#34; xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;vertical&#34; height=&#34;600&#34; width=&#34;800&#34; &#62;
	&#60;mx:Script&#62;
        &#60;!&#91;CDATA&#91;
            [...]]]></description>
			<content:encoded><![CDATA[<p>AIR 2.0 有很多令人期待和振奋的功能，使得AIR向成熟的桌面应用程序开发环境又进了一大步。上一篇文章里介绍了ServerSocket的用法，这篇教程中将向大家介绍NativeProcess，在AIR2.0中我们可以使用程序默认的打开方式直接打开一个外部的应用程序 (<span style="font-family: Monaco, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: normal; font-size: 11px; ">file.openWithDefaultApplication()<span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; ">) 或者 通过今天要讲的启动进程方式运行一个程序。</span></span></p>
<p>AIR与本地应用程序的交互是AIR 2.0的一个重要更新，这个功能的实现可以帮助我们做到在AIR 1.5时代很难完成的事情，比如我在项目中就需要操作一些硬件，但AIR不能直接操作端口，所以只能借助其他的小程序来实现，现在我们就可以很容易的操作这些小程序以达到操作硬件的目的，而Flex (AIR)与JAVA的结合很早就已经开始了，但由于早期AIR的局限性，想要把JAVA直接部署在客户端还是比较麻烦的事情，但是从AIR2.0开始我们不用担心了。现在我们用很简单的方式就可以在AIR程序中集成TOMCAT, 一次性的将后台与AIR部署到客户端。</p>
<p>程序的原版（Flash Builder 4版）同样是从http://coenraets.org/获得，有兴趣的朋友可以关注这个博客。我的例子仍然使用FLEX 3.</p>
<p style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; background-position: initial initial; padding: 0px; border: 0px initial initial;"><strong>Demo过程</strong></p>
<ol style="margin-top: 5px; margin-right: 0px; margin-bottom: 5px; margin-left: 20px; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; list-style-type: decimal; list-style-position: initial; list-style-image: initial; background-position: initial initial; padding: 0px; border: 0px initial initial;">
<li style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; background-position: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">下载安装 <a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; color: #000000; background-position: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;" href="http://labs.adobe.com/downloads/air2.html" target="_blank">AIR 2.0 beta runtime</a>.</li>
<li style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; background-position: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">下载AIRAppWithEmbeddedTomcat..exe 或者 AIRAppWithEmbeddedTomcat.dmg (NativeProcess 必须在程序发布为相应平台的应用程序后才可以使用，发布的方法这里就不介绍了，可以参看http://help.adobe.com/en_US/FlashPlatform/develop/air/building_apps/WS789ea67d3e73a8b22388411123785d839c-8000.html)</li>
<li style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; background-position: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">安装运行AIRAppWithEmbeddedTomcat.exe, 修改JAVA_HOME，如果默认的路径不对</li>
<li style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: transparent; background-position: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">点击 &#8220;启动&#8221; 可以开启TOMCAT(端口是8080)。在JSP实例和RemoteObject实例中可以看见加载JSP页面和使用RemoteObject获取数据的测试。</li>
</ol>
<p><span id="more-670"></span></p>
<p><strong>控制台</strong></p>
<p><strong> </strong></p>
<p><img class="alignnone size-full wp-image-672" title="a" src="http://www.flextheworld.com/wp-content/uploads/2010/01/a1.gif" alt="a" width="700" height="503" /></p>
<p><strong>JSP 加载测试</strong></p>
<p><strong><img class="alignnone size-full wp-image-673" title="b" src="http://www.flextheworld.com/wp-content/uploads/2010/01/b.gif" alt="b" width="693" height="499" /></strong></p>
<p><strong>RemoteObject 测试</strong></p>
<p><strong><img class="alignnone size-full wp-image-674" title="c" src="http://www.flextheworld.com/wp-content/uploads/2010/01/c.gif" alt="c" width="690" height="499" /></strong></p>
<p><strong>源代码</strong></p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p670code6'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6706"><td class="code" id="p670code6"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;!--</span>www<span style="color: #000066; font-weight: bold;">.</span>flextheworld<span style="color: #000066; font-weight: bold;">.</span>com<span style="color: #000066; font-weight: bold;">--&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>WindowedApplication applicationComplete=<span style="color: #990000;">&quot;init()&quot;</span> xmlns<span style="color: #000066; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #990000;">&quot;vertical&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;600&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;800&quot;</span> <span style="color: #000066; font-weight: bold;">&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
        <span style="color: #000066; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
            <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>controls<span style="color: #000066; font-weight: bold;">.</span>Alert<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
            <span style="color: #009900; font-style: italic;">//用于启动和停止Tomcat的进程</span>
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> startTomcatProcess<span style="color: #000066; font-weight: bold;">:</span>NativeProcess<span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> stopTomcatProcess<span style="color: #000066; font-weight: bold;">:</span>NativeProcess<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> tomcatHomeDir<span style="color: #000066; font-weight: bold;">:</span>File<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>NativeProcess<span style="color: #000066; font-weight: bold;">.</span>isSupported<span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    Alert<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;不支持进程控制，请先将程序发布为当前操作系统应用程序&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
&nbsp;
                <span style="color: #009900; font-style: italic;">//如果tomcat不存在，重新复制到app store文件夹</span>
                tomcatHomeDir = File<span style="color: #000066; font-weight: bold;">.</span>applicationStorageDirectory<span style="color: #000066; font-weight: bold;">.</span>resolvePath<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;tomcat&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>tomcatHomeDir<span style="color: #000066; font-weight: bold;">.</span>exists<span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    <span style="color: #6699cc; font-weight: bold;">var</span> tomcatOriginalDir<span style="color: #000066; font-weight: bold;">:</span>File = File<span style="color: #000066; font-weight: bold;">.</span>applicationDirectory<span style="color: #000066; font-weight: bold;">.</span>resolvePath<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;tomcat&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Copying tomcat to appStorageDirectory...&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    tomcatOriginalDir<span style="color: #000066; font-weight: bold;">.</span>copyTo<span style="color: #000000;">&#40;</span>tomcatHomeDir<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #6699cc; font-weight: bold;">var</span> f<span style="color: #000066; font-weight: bold;">:</span>File<span style="color: #000066; font-weight: bold;">;</span>
                    f<span style="color: #000066; font-weight: bold;">.</span>openWithDefaultApplication<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#125;</span>
&nbsp;
&nbsp;
                tomcatHome<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = tomcatHomeDir<span style="color: #000066; font-weight: bold;">.</span>nativePath<span style="color: #000066; font-weight: bold;">;</span>             
&nbsp;
                <span style="color: #009900; font-style: italic;">// 读取保存的配置（第一次运行以后生成）</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> xml<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=xml%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xml.html"><span style="color: #004993;">XML</span></a> = readConfig<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>xml <span style="color: #000066; font-weight: bold;">!</span>= <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    javaHome<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = xml<span style="color: #000066; font-weight: bold;">.</span>javaHome<span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #0033ff; font-weight: bold;">return</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
&nbsp;
                <span style="color: #009900; font-style: italic;">// 如果第一次使用，设置默认Path</span>
                <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=capabilities%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:capabilities.html"><span style="color: #004993;">Capabilities</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">os</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">toLowerCase</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">indexOf</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;win&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    <span style="color: #009900; font-style: italic;">// 默认的JAVA_HOME (windows)</span>
                    javaHome<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;C:<span style="">\\</span>Program Files<span style="">\\</span>Java<span style="">\\</span>jdk1.6.0&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
                <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=capabilities%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:capabilities.html"><span style="color: #004993;">Capabilities</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">os</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">toLowerCase</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">indexOf</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;mac&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    <span style="color: #009900; font-style: italic;">// 默认的JAVA_HOME (Mac)</span>
                    javaHome<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> startTomcat<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #009900; font-style: italic;">// 将本次的JAVA_HOMR写入配置文件</span>
                writeConfig<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
                <span style="color: #004993;">log</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Starting Tomcat...&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> File<span style="color: #000066; font-weight: bold;">.</span>lineEnding<span style="color: #000066; font-weight: bold;">;</span>
                startTomcatProcess = <span style="color: #0033ff; font-weight: bold;">new</span> NativeProcess<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                execute<span style="color: #000000;">&#40;</span>startTomcatProcess<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;start&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> stopTomcat<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #004993;">log</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Stopping Tomcat...&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> File<span style="color: #000066; font-weight: bold;">.</span>lineEnding<span style="color: #000066; font-weight: bold;">;</span>
                stopTomcatProcess = <span style="color: #0033ff; font-weight: bold;">new</span> NativeProcess<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                execute<span style="color: #000000;">&#40;</span>startTomcatProcess<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;stop&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> execute<span style="color: #000000;">&#40;</span>process<span style="color: #000066; font-weight: bold;">:</span>NativeProcess<span style="color: #000066; font-weight: bold;">,</span> arg<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #009900; font-style: italic;">// 先获取JVM</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> file<span style="color: #000066; font-weight: bold;">:</span>File = <span style="color: #0033ff; font-weight: bold;">new</span> File<span style="color: #000000;">&#40;</span>javaHome<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=capabilities%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:capabilities.html"><span style="color: #004993;">Capabilities</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">os</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">toLowerCase</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">indexOf</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;win&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    file = file<span style="color: #000066; font-weight: bold;">.</span>resolvePath<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;bin/javaw.exe&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
                <span style="color: #0033ff; font-weight: bold;">else</span>
                <span style="color: #000000;">&#123;</span>
                    file = file<span style="color: #000066; font-weight: bold;">.</span>resolvePath<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Home/bin/java&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
&nbsp;
                <span style="color: #009900; font-style: italic;">// 启动TOMCAT</span>
                <span style="color: #0033ff; font-weight: bold;">try</span>
                <span style="color: #000000;">&#123;</span>
                    <span style="color: #6699cc; font-weight: bold;">var</span> nativeProcessStartupInfo<span style="color: #000066; font-weight: bold;">:</span>NativeProcessStartupInfo = <span style="color: #0033ff; font-weight: bold;">new</span> NativeProcessStartupInfo<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    nativeProcessStartupInfo<span style="color: #000066; font-weight: bold;">.</span>executable = file<span style="color: #000066; font-weight: bold;">;</span>
                    nativeProcessStartupInfo<span style="color: #000066; font-weight: bold;">.</span>workingDirectory = tomcatHomeDir<span style="color: #000066; font-weight: bold;">.</span>resolvePath<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;bin&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #6699cc; font-weight: bold;">var</span> processArgs<span style="color: #000066; font-weight: bold;">:</span>Vector<span style="color: #000066; font-weight: bold;">.&lt;</span>String<span style="color: #000066; font-weight: bold;">&gt;</span> = <span style="color: #0033ff; font-weight: bold;">new</span> Vector<span style="color: #000066; font-weight: bold;">.&lt;</span>String<span style="color: #000066; font-weight: bold;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    processArgs<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span> = <span style="color: #990000;">&quot;-Dcatalina.home=&quot;</span><span style="color: #000066; font-weight: bold;">+</span>tomcatHomeDir<span style="color: #000066; font-weight: bold;">.</span>nativePath<span style="color: #000066; font-weight: bold;">;</span>
                    processArgs<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span> = <span style="color: #990000;">&quot;-classpath&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
                    processArgs<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#93;</span> = tomcatHomeDir<span style="color: #000066; font-weight: bold;">.</span>resolvePath<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;bin/bootstrap.jar&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span>nativePath<span style="color: #000066; font-weight: bold;">;</span>
                    processArgs<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">3</span><span style="color: #000000;">&#93;</span> = <span style="color: #990000;">&quot;org.apache.catalina.startup.Bootstrap&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
                    processArgs<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">4</span><span style="color: #000000;">&#93;</span> = arg<span style="color: #000066; font-weight: bold;">;</span>
                    nativeProcessStartupInfo<span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=arguments%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:arguments.html"><span style="color: #004993;">arguments</span></a> = processArgs<span style="color: #000066; font-weight: bold;">;</span>
                    startTomcatProcess = <span style="color: #0033ff; font-weight: bold;">new</span> NativeProcess<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    startTomcatProcess<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">start</span><span style="color: #000000;">&#40;</span>nativeProcessStartupInfo<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    startTomcatProcess<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=progressevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:progressevent.html"><span style="color: #004993;">ProgressEvent</span></a><span style="color: #000066; font-weight: bold;">.</span>STANDARD_OUTPUT_DATA<span style="color: #000066; font-weight: bold;">,</span>
                        outputDataHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    startTomcatProcess<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=progressevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:progressevent.html"><span style="color: #004993;">ProgressEvent</span></a><span style="color: #000066; font-weight: bold;">.</span>STANDARD_ERROR_DATA<span style="color: #000066; font-weight: bold;">,</span>
                        errorOutputDataHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
                <span style="color: #0033ff; font-weight: bold;">catch</span> <span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=error%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:error.html"><span style="color: #004993;">Error</span></a><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    Alert<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">message</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;Error&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> outputDataHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=progressevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:progressevent.html"><span style="color: #004993;">ProgressEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> process<span style="color: #000066; font-weight: bold;">:</span>NativeProcess = event<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span> <span style="color: #0033ff; font-weight: bold;">as</span> NativeProcess<span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = process<span style="color: #000066; font-weight: bold;">.</span>standardOutput<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">readUTFBytes</span><span style="color: #000000;">&#40;</span>process<span style="color: #000066; font-weight: bold;">.</span>standardOutput<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">bytesAvailable</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #004993;">log</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> errorOutputDataHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=progressevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:progressevent.html"><span style="color: #004993;">ProgressEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> process<span style="color: #000066; font-weight: bold;">:</span>NativeProcess = event<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span> <span style="color: #0033ff; font-weight: bold;">as</span> NativeProcess<span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = process<span style="color: #000066; font-weight: bold;">.</span>standardError<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">readUTFBytes</span><span style="color: #000000;">&#40;</span>startTomcatProcess<span style="color: #000066; font-weight: bold;">.</span>standardError<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">bytesAvailable</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #004993;">log</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> readConfig<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=xml%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xml.html"><span style="color: #004993;">XML</span></a>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> file<span style="color: #000066; font-weight: bold;">:</span>File = File<span style="color: #000066; font-weight: bold;">.</span>applicationStorageDirectory<span style="color: #000066; font-weight: bold;">.</span>resolvePath<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;config.xml&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>file<span style="color: #000066; font-weight: bold;">.</span>exists<span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    <span style="color: #6699cc; font-weight: bold;">var</span> fileStream<span style="color: #000066; font-weight: bold;">:</span>FileStream = <span style="color: #0033ff; font-weight: bold;">new</span> FileStream<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    fileStream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">open</span><span style="color: #000000;">&#40;</span>file<span style="color: #000066; font-weight: bold;">,</span> FileMode<span style="color: #000066; font-weight: bold;">.</span>READ<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #6699cc; font-weight: bold;">var</span> xml<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=xml%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xml.html"><span style="color: #004993;">XML</span></a> = <a href="http://www.google.com/search?q=xml%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:xml.html"><span style="color: #004993;">XML</span></a><span style="color: #000000;">&#40;</span>fileStream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">readUTFBytes</span><span style="color: #000000;">&#40;</span>fileStream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">bytesAvailable</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    fileStream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #0033ff; font-weight: bold;">return</span> xml<span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
                <span style="color: #0033ff; font-weight: bold;">else</span>
                <span style="color: #000000;">&#123;</span>
                    <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> writeConfig<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> xml<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">'&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;'</span> <span style="color: #000066; font-weight: bold;">+</span> File<span style="color: #000066; font-weight: bold;">.</span>lineEnding<span style="color: #000066; font-weight: bold;">;</span>
                xml <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;&lt;config&gt;&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> File<span style="color: #000066; font-weight: bold;">.</span>lineEnding<span style="color: #000066; font-weight: bold;">;</span>
                xml <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;&lt;javaHome&gt;&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> javaHome<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot;&lt;/javaHome&gt;&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> File<span style="color: #000066; font-weight: bold;">.</span>lineEnding<span style="color: #000066; font-weight: bold;">;</span>
                xml <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;&lt;tomcatHome&gt;&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> tomcatHome<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot;&lt;/tomcatHome&gt;&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> File<span style="color: #000066; font-weight: bold;">.</span>lineEnding<span style="color: #000066; font-weight: bold;">;</span>
                xml <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;&lt;/config&gt;&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> File<span style="color: #000066; font-weight: bold;">.</span>lineEnding<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
                <span style="color: #6699cc; font-weight: bold;">var</span> file<span style="color: #000066; font-weight: bold;">:</span>File = File<span style="color: #000066; font-weight: bold;">.</span>applicationStorageDirectory<span style="color: #000066; font-weight: bold;">.</span>resolvePath<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;config.xml&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> fileStream<span style="color: #000066; font-weight: bold;">:</span>FileStream = <span style="color: #0033ff; font-weight: bold;">new</span> FileStream<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                fileStream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">open</span><span style="color: #000000;">&#40;</span>file<span style="color: #000066; font-weight: bold;">,</span> FileMode<span style="color: #000066; font-weight: bold;">.</span>WRITE<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                fileStream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">writeUTFBytes</span><span style="color: #000000;">&#40;</span>xml<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                fileStream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
&nbsp;
        <span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
    <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>RemoteObject id=<span style="color: #990000;">&quot;srv&quot;</span> destination=<span style="color: #990000;">&quot;contacts&quot;</span> endpoint=<span style="color: #990000;">&quot;http://localhost:8080/messagebroker/amf&quot;</span> <span style="color: #000066; font-weight: bold;">/&gt;</span>
    <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>TabNavigator <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
        <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>VBox <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span> label=<span style="color: #990000;">&quot;控制台&quot;</span> paddingLeft=<span style="color: #990000;">&quot;8&quot;</span> paddingRight=<span style="color: #990000;">&quot;8&quot;</span> paddingBottom=<span style="color: #990000;">&quot;8&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
            <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Form <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
                <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>FormItem label=<span style="color: #990000;">&quot;Java Home&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
                    <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>TextInput id=<span style="color: #990000;">&quot;javaHome&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
                <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>FormItem<span style="color: #000066; font-weight: bold;">&gt;</span>
                <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>FormItem label=<span style="color: #990000;">&quot;Tomcat Home (嵌入的TOMCAT)&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
                    <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>TextInput id=<span style="color: #990000;">&quot;tomcatHome&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">enabled</span>=<span style="color: #990000;">&quot;false&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
                <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>FormItem<span style="color: #000066; font-weight: bold;">&gt;</span>
            <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Form<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
            <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>HBox<span style="color: #000066; font-weight: bold;">&gt;</span>
                <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;启动&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;startTomcat()&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
                <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;停止&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;stopTomcat()&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
                <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;清除信息&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;log.text=''&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
&nbsp;
            <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>HBox<span style="color: #000066; font-weight: bold;">&gt;</span>
            <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>TextArea id=<span style="color: #990000;">&quot;log&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>VBox<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>VBox label=<span style="color: #990000;">&quot;嵌入的JSP实例&quot;</span> paddingLeft=<span style="color: #990000;">&quot;8&quot;</span> paddingRight=<span style="color: #990000;">&quot;8&quot;</span> paddingBottom=<span style="color: #990000;">&quot;8&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
            <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>HTML id=<span style="color: #990000;">&quot;html&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
            <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;读取JSP&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;html.location='http://localhost:8080'&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
        <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>VBox<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>VBox label=<span style="color: #990000;">&quot;嵌入的RemoteObject实例&quot;</span> paddingLeft=<span style="color: #990000;">&quot;8&quot;</span> paddingRight=<span style="color: #990000;">&quot;8&quot;</span> paddingBottom=<span style="color: #990000;">&quot;8&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
            <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>DataGrid <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span> dataProvider=<span style="color: #990000;">&quot;{srv.findAll.lastResult}&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
                <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>columns<span style="color: #000066; font-weight: bold;">&gt;</span>
                    <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>DataGridColumn dataField=<span style="color: #990000;">&quot;id&quot;</span> headerText=<span style="color: #990000;">&quot;Id&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
                    <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>DataGridColumn dataField=<span style="color: #990000;">&quot;firstName&quot;</span> headerText=<span style="color: #990000;">&quot;First Name&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
                    <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>DataGridColumn dataField=<span style="color: #990000;">&quot;lastName&quot;</span> headerText=<span style="color: #990000;">&quot;Last Name&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
                    <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>DataGridColumn dataField=<span style="color: #990000;">&quot;city&quot;</span> headerText=<span style="color: #990000;">&quot;City&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
                <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>columns<span style="color: #000066; font-weight: bold;">&gt;</span>
            <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>DataGrid<span style="color: #000066; font-weight: bold;">&gt;</span>
            <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;获取数据&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;srv.findAll()&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
        <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>VBox<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>TabNavigator<span style="color: #000066; font-weight: bold;">&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>WindowedApplication<span style="color: #000066; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p><strong>下载</strong></p>
<p><strong> </strong><br />
源代码: <a class="downloadlink" href="http://www.flextheworld.com/wp-content/plugins/download-monitor/download.php?id=21" title=" downloaded 71 times" >AIRAppWithEmbeddedTomcat.zip (71)</a></p>
<p>windows demo: <a class="downloadlink" href="http://www.flextheworld.com/wp-content/plugins/download-monitor/download.php?id=22" title=" downloaded 55 times" >AIRAppWithEmbeddedTomcat.exe (55)</a></p>
<p>Mac Demo: <a class="downloadlink" href="http://www.flextheworld.com/wp-content/plugins/download-monitor/download.php?id=23" title=" downloaded 39 times" >AIRAppWithEmbeddedTomcat.dmg (39)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flextheworld.com/2010/01/air-2-tomcat-nativeprocess.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AIR 迷你教程 &#8212; 用AIR 2.0创建迷你Web服务器（ServerSocket 实例）</title>
		<link>http://www.flextheworld.com/2010/01/air-2-serversocket.html</link>
		<comments>http://www.flextheworld.com/2010/01/air-2-serversocket.html#comments</comments>
		<pubDate>Wed, 06 Jan 2010 07:33:34 +0000</pubDate>
		<dc:creator>Kevin Luo</dc:creator>
				<category><![CDATA[AIR 迷你教程]]></category>
		<category><![CDATA[未分类]]></category>
		<category><![CDATA[AIR 2.0]]></category>

		<guid isPermaLink="false">http://www.flextheworld.com/?p=660</guid>
		<description><![CDATA[AIR 2.0 一个非常重要的更新是支持了对Socket的监听，包括TCP (ServerSocket)以及UDP(DatagramSocket)。另外也支持了以UDP方式对外发送信息。这两个功能的增加无疑大大的增加了AIR的应用范围，比如&#8230;&#8230;&#8230;..这一下想个具体的还是比较困难，比如协作型的应用程序。
这篇教程将使用ServerSocket功能做一个HTML服务器，这个不是我原创的，是看到一个老外写的，觉得很有意思，是一个ServerSocket的好例子，原文在 http://coenraets.org/blog/2009/12/air-2-0-web-server-using-the-new-server-socket-api/. 原文是Flash Builder 4 版本的，这里我给大家的是Flex 3版本, 使用源代码请先下载AIR 2.0 SDK
Demo过程

下载安装 AIR 2.0 beta runtime.
下载MiniAIRWebServer.air
安装运行 MiniAIRWebServer.air.
运行 http://localhost:8765/HelloWorld.html （端口以你在运行MiniAIRWebServer.air后输入的为准, 注意安装MiniAIRWebServer.air后安装文件夹下的webroot/HelloWorld.html, 我们运行的就是这个文件）

运行效果如下:

源代码

?View Code ACTIONSCRIPT3&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;mx:WindowedApplication xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;vertical&#34; close=&#34;closeHandler()&#34; creationComplete=&#34;init()&#34;&#62;
	&#60;mx:Script&#62;
		&#60;!&#91;CDATA&#91;
			import flash.events.Event;
            import flash.events.ProgressEvent;
            [...]]]></description>
			<content:encoded><![CDATA[<p>AIR 2.0 一个非常重要的更新是支持了对Socket的监听，包括TCP (ServerSocket)以及UDP(DatagramSocket)。另外也支持了以UDP方式对外发送信息。这两个功能的增加无疑大大的增加了AIR的应用范围，比如&#8230;&#8230;&#8230;..这一下想个具体的还是比较困难，比如协作型的应用程序。</p>
<p>这篇教程将使用ServerSocket功能做一个HTML服务器，这个不是我原创的，是看到一个老外写的，觉得很有意思，是一个ServerSocket的好例子，原文在 http://coenraets.org/blog/2009/12/air-2-0-web-server-using-the-new-server-socket-api/. 原文是Flash Builder 4 版本的，这里我给大家的是Flex 3版本, 使用源代码请先下载<a href="http://labs.adobe.com/downloads/air2.html" target="_blank">AIR 2.0 SDK</a></p>
<p>Demo过程</p>
<ol>
<li>下载安装 <a href="http://labs.adobe.com/downloads/air2.html" target="_blank">AIR 2.0 beta runtime</a>.</li>
<li>下载MiniAIRWebServer.air</li>
<li>安装运行 MiniAIRWebServer.air.</li>
<li>运行 http://localhost:8765/HelloWorld.html （端口以你在运行MiniAIRWebServer.air后输入的为准, 注意安装MiniAIRWebServer.air后安装文件夹下的webroot/HelloWorld.html, 我们运行的就是这个文件）</li>
</ol>
<p>运行效果如下:</p>
<p><img class="alignnone size-full wp-image-664" title="airserver" src="http://www.flextheworld.com/wp-content/uploads/2010/01/airserver.jpg" alt="airserver" width="341" height="235" /></p>
<p>源代码</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p660code8'); return false;">View Code</a> ACTIONSCRIPT3</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6608"><td class="code" id="p660code8"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;?</span>xml <span style="color: #004993;">version</span>=<span style="color: #990000;">&quot;1.0&quot;</span> encoding=<span style="color: #990000;">&quot;utf-8&quot;</span><span style="color: #000066; font-weight: bold;">?&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>WindowedApplication xmlns<span style="color: #000066; font-weight: bold;">:</span>mx=<span style="color: #990000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #990000;">&quot;vertical&quot;</span> <span style="color: #004993;">close</span>=<span style="color: #990000;">&quot;closeHandler()&quot;</span> creationComplete=<span style="color: #990000;">&quot;init()&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
		<span style="color: #000066; font-weight: bold;">&lt;!</span><span style="color: #000000;">&#91;</span>CDATA<span style="color: #000000;">&#91;</span>
			<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=progressevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:progressevent.html"><span style="color: #004993;">ProgressEvent</span></a><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.</span>ServerSocketConnectEvent<span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.net</span><span style="color: #000066; font-weight: bold;">.</span>ServerSocket<span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.net</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=socket%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:socket.html"><span style="color: #004993;">Socket</span></a><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span><span style="color: #000066; font-weight: bold;">.</span><a href="http://www.google.com/search?q=bytearray%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bytearray.html"><span style="color: #004993;">ByteArray</span></a><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>controls<span style="color: #000066; font-weight: bold;">.</span>Alert<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
&nbsp;
            <span style="color: #009900; font-style: italic;">//ServerSocket，用于监听TCP下的链接</span>
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> serverSocket<span style="color: #000066; font-weight: bold;">:</span>ServerSocket<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> mimeTypes<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=object%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:object.html"><span style="color: #004993;">Object</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #009900; font-style: italic;">// 支持的类型</span>
                mimeTypes<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;.css&quot;</span><span style="color: #000000;">&#93;</span>     = <span style="color: #990000;">&quot;text/css&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
                mimeTypes<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;.gif&quot;</span><span style="color: #000000;">&#93;</span>     = <span style="color: #990000;">&quot;image/gif&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
                mimeTypes<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;.htm&quot;</span><span style="color: #000000;">&#93;</span>     = <span style="color: #990000;">&quot;text/html&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
                mimeTypes<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;.html&quot;</span><span style="color: #000000;">&#93;</span>     = <span style="color: #990000;">&quot;text/html&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
                mimeTypes<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;.ico&quot;</span><span style="color: #000000;">&#93;</span>     = <span style="color: #990000;">&quot;image/x-icon&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
                mimeTypes<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;.jpg&quot;</span><span style="color: #000000;">&#93;</span>     = <span style="color: #990000;">&quot;image/jpeg&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
                mimeTypes<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;.js&quot;</span><span style="color: #000000;">&#93;</span>     = <span style="color: #990000;">&quot;application/x-javascript&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
                mimeTypes<span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;.png&quot;</span><span style="color: #000000;">&#93;</span>     = <span style="color: #990000;">&quot;image/png&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
                <span style="color: #009900; font-style: italic;">// 初始化服务器文件夹</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> webroot<span style="color: #000066; font-weight: bold;">:</span>File = File<span style="color: #000066; font-weight: bold;">.</span>applicationStorageDirectory<span style="color: #000066; font-weight: bold;">.</span>resolvePath<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;webroot&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000066; font-weight: bold;">!</span>webroot<span style="color: #000066; font-weight: bold;">.</span>exists<span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    File<span style="color: #000066; font-weight: bold;">.</span>applicationDirectory<span style="color: #000066; font-weight: bold;">.</span>resolvePath<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;webroot&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span>copyTo<span style="color: #000000;">&#40;</span>webroot<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> listen<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #0033ff; font-weight: bold;">try</span>
                <span style="color: #000000;">&#123;</span>
&nbsp;
                    serverSocket = <span style="color: #0033ff; font-weight: bold;">new</span> ServerSocket<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #009900; font-style: italic;">//监听链接</span>
                    serverSocket<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=event%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:event.html"><span style="color: #004993;">Event</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">CONNECT</span><span style="color: #000066; font-weight: bold;">,</span> socketConnectHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #009900; font-style: italic;">//绑定端口</span>
                    serverSocket<span style="color: #000066; font-weight: bold;">.</span>bind<span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=number%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:number.html"><span style="color: #004993;">Number</span></a><span style="color: #000000;">&#40;</span>port<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #009900; font-style: italic;">//开始</span>
                    serverSocket<span style="color: #000066; font-weight: bold;">.</span>listen<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #004993;">log</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> <span style="color: #000066; font-weight: bold;">+</span>= <span style="color: #990000;">&quot;正在监听 &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> port<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot;端口...<span style="">\n</span>&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
                <span style="color: #0033ff; font-weight: bold;">catch</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">error</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=error%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:error.html"><span style="color: #004993;">Error</span></a><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    Alert<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;端口 &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> port<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> <span style="color: #000066; font-weight: bold;">+</span> 
                        <span style="color: #990000;">&quot; 也许正在被使用，请尝试另一个端口.<span style="">\n</span>(&quot;</span> <span style="color: #000066; font-weight: bold;">+</span>
                        <span style="color: #004993;">error</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">message</span> <span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot;)&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;错误&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> socketConnectHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>ServerSocketConnectEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> socket<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=socket%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:socket.html"><span style="color: #004993;">Socket</span></a> = event<span style="color: #000066; font-weight: bold;">.</span>socket<span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #009900; font-style: italic;">//监听数据</span>
                socket<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=progressevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:progressevent.html"><span style="color: #004993;">ProgressEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">SOCKET_DATA</span><span style="color: #000066; font-weight: bold;">,</span> socketDataHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> socketDataHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=progressevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:progressevent.html"><span style="color: #004993;">ProgressEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #0033ff; font-weight: bold;">try</span>
                <span style="color: #000000;">&#123;</span>
                    <span style="color: #6699cc; font-weight: bold;">var</span> socket<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=socket%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:socket.html"><span style="color: #004993;">Socket</span></a> = event<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span> <span style="color: #0033ff; font-weight: bold;">as</span> <a href="http://www.google.com/search?q=socket%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:socket.html"><span style="color: #004993;">Socket</span></a><span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #6699cc; font-weight: bold;">var</span> bytes<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=bytearray%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bytearray.html"><span style="color: #004993;">ByteArray</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=bytearray%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bytearray.html"><span style="color: #004993;">ByteArray</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    socket<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">readBytes</span><span style="color: #000000;">&#40;</span>bytes<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #6699cc; font-weight: bold;">var</span> request<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = <span style="color: #990000;">&quot;&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> bytes<span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #004993;">log</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> <span style="color: #000066; font-weight: bold;">+</span>= request<span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #6699cc; font-weight: bold;">var</span> filePath<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a> = request<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">substring</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">4</span><span style="color: #000066; font-weight: bold;">,</span> request<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">indexOf</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;HTTP/&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #6699cc; font-weight: bold;">var</span> file<span style="color: #000066; font-weight: bold;">:</span>File = File<span style="color: #000066; font-weight: bold;">.</span>applicationStorageDirectory<span style="color: #000066; font-weight: bold;">.</span>resolvePath<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;webroot&quot;</span> <span style="color: #000066; font-weight: bold;">+</span> filePath<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>file<span style="color: #000066; font-weight: bold;">.</span>exists <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> <span style="color: #000066; font-weight: bold;">!</span>file<span style="color: #000066; font-weight: bold;">.</span>isDirectory<span style="color: #000000;">&#41;</span>
                    <span style="color: #000000;">&#123;</span>
                        <span style="color: #6699cc; font-weight: bold;">var</span> stream<span style="color: #000066; font-weight: bold;">:</span>FileStream = <span style="color: #0033ff; font-weight: bold;">new</span> FileStream<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                        stream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">open</span><span style="color: #000000;">&#40;</span> file<span style="color: #000066; font-weight: bold;">,</span> FileMode<span style="color: #000066; font-weight: bold;">.</span>READ <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                        <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">content</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=bytearray%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bytearray.html"><span style="color: #004993;">ByteArray</span></a> = <span style="color: #0033ff; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=bytearray%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:bytearray.html"><span style="color: #004993;">ByteArray</span></a><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                        stream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">readBytes</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">content</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                        stream<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                        socket<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">writeUTFBytes</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;HTTP/1.1 200 OK<span style="">\n</span>&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                        socket<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">writeUTFBytes</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Content-Type: &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> getMimeType<span style="color: #000000;">&#40;</span>filePath<span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot;<span style="">\n</span><span style="">\n</span>&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                        socket<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">writeBytes</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">content</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #000000;">&#125;</span>
                    <span style="color: #0033ff; font-weight: bold;">else</span>
                    <span style="color: #000000;">&#123;</span>
                        socket<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">writeUTFBytes</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;HTTP/1.1 404 Not Found<span style="">\n</span>&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                        socket<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">writeUTFBytes</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;Content-Type: text/html<span style="">\n</span><span style="">\n</span>&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                        socket<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">writeUTFBytes</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;&lt;html&gt;&lt;body&gt;&lt;h2&gt;Page Not Found&lt;/h2&gt;&lt;/body&gt;&lt;/html&gt;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    <span style="color: #000000;">&#125;</span>
                    socket<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">flush</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                    socket<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
                <span style="color: #0033ff; font-weight: bold;">catch</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">error</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=error%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:error.html"><span style="color: #004993;">Error</span></a><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    Alert<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">error</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">message</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;错误&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> getMimeType<span style="color: #000000;">&#40;</span>path<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> mimeType<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=string%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:string.html"><span style="color: #004993;">String</span></a><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">index</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=int%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:int.html"><span style="color: #004993;">int</span></a> = path<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">lastIndexOf</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">index</span> <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000066; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    mimeType = mimeTypes<span style="color: #000000;">&#91;</span>path<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">substring</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">index</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span>
                <span style="color: #000000;">&#125;</span>
                <span style="color: #0033ff; font-weight: bold;">return</span> mimeType == <span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000066; font-weight: bold;">?</span> <span style="color: #990000;">&quot;text/html&quot;</span> <span style="color: #000066; font-weight: bold;">:</span> mimeType<span style="color: #000066; font-weight: bold;">;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> closeHandler<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span><span style="color: #000000;">&#123;</span>
            	<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>serverSocket<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
            		serverSocket<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
            	<span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #000000;">&#125;</span>
		<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
	<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>Script<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>HBox verticalAlign=<span style="color: #990000;">&quot;middle&quot;</span><span style="color: #000066; font-weight: bold;">&gt;</span>
        <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Label <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;Port:&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
        <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>TextInput id=<span style="color: #990000;">&quot;port&quot;</span> <span style="color: #004993;">text</span>=<span style="color: #990000;">&quot;8765&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;50&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
        <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>Button label=<span style="color: #990000;">&quot;Listen&quot;</span> <span style="color: #004993;">click</span>=<span style="color: #990000;">&quot;listen()&quot;</span><span style="color: #000066; font-weight: bold;">/&gt;</span>
    <span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>HBox<span style="color: #000066; font-weight: bold;">&gt;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">&lt;</span>mx<span style="color: #000066; font-weight: bold;">:</span>TextArea id=<span style="color: #990000;">&quot;log&quot;</span> <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;100%&quot;</span> <span style="color: #000066; font-weight: bold;">/&gt;</span>
<span style="color: #000066; font-weight: bold;">&lt;/</span>mx<span style="color: #000066; font-weight: bold;">:</span>WindowedApplication<span style="color: #000066; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>下载:</p>
<a class="downloadlink" href="http://www.flextheworld.com/wp-content/plugins/download-monitor/download.php?id=19" title=" downloaded 99 times" >MIniAIRWebServer.air (99)</a>
<a class="downloadlink" href="http://www.flextheworld.com/wp-content/plugins/download-monitor/download.php?id=20" title=" downloaded 100 times" >MIniAIRWebServer.zip (100)</a>
]]></content:encoded>
			<wfw:commentRss>http://www.flextheworld.com/2010/01/air-2-serversocket.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Flex 迷你教程 &#8212; 在AdvancedDataGrid中合并单元格 （合并行）</title>
		<link>http://www.flextheworld.com/2009/12/flex-advanceddatagrid-rowspan.html</link>
		<comments>http://www.flextheworld.com/2009/12/flex-advanceddatagrid-rowspan.html#comments</comments>
		<pubDate>Sun, 20 Dec 2009 04:21:49 +0000</pubDate>
		<dc:creator>Kevin Luo</dc:creator>
				<category><![CDATA[Flex 迷你教程]]></category>
		<category><![CDATA[开源控件]]></category>
		<category><![CDATA[DataGrid rowspan]]></category>
		<category><![CDATA[合并单元格]]></category>

		<guid isPermaLink="false">http://www.flextheworld.com/?p=633</guid>
		<description><![CDATA[在项目中我们对DataGrid的要求是很高的，但很不幸的Flex 的DataGird的功能是很傻的，这就催生了AdvancedDatgrid, 它确实解决了很多DataGrid不能做的事，比如多级排序，单元格选择，树状显示数据，合并表头等，但是不知道为什么它确忘记了 “合并单元格”这么重要的事。好在牛人是很多的，于是出现了MecGrid, NecGrid这样不错的能解决单元格合并的DataGrid, 不过他们都各有缺点。
MecGrid: （http://www.mechansp.com/index.php）
1. 不支持itemrender。
2. 单元格选择时无法获知整行数据。
3. 不支持xxxFunction设置比如（labelFunction）
4. 设置很不方便。在column设置中大量使用 number作为参数，非常非常的不利于使用，在线文档对这个ResourceXML的设置也没有提到具体细节，这个很头痛.
总结: MecGrid的使用非常不方便，而且完全不支持复杂数据类型，虽然实现了很多功能但都是固定功能，扩展性不强。这让他局限在只能作为表格使用。
NEC Grid （http://www.necst.co.jp/product/ibiz/column/ibizblock/chap7.html）

1. 不能改变行高。
2. 破换了itemrender的使用，我增加了一个ComboBox作为itemrender,但是他的显示完全不正常。如果itemrender的高度大于他的默认行高，显示会被切断。
3. 不支持单元格选择。
总结：这个DataGrid的使用非常方便，不过缺点也比较明显，尤其是对itemrender这条，要命的是他不能改变行高，但实际中我们的数据是很有可能换行的。另外他居然不支持单元格选择，作为一个AdvancedDatagird,单元格选择在很多时候是必要的。总的来说这个DataGrid用于对数据操作没有特殊要求的用户是不错的选择。
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-废话结束，教程开始的分割线&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;


在看完了老美和日本人做的DataGrid后找到一个韩国人做的，名字就叫AdavcnedDataGrid, 相比Mec和Nec, 扩展的功能比较单一，Bug也非常多，只有合并单元格功能，基于Flex 的AdvancedDataGrid实现。不过也是保留原有 AdvancedDataGrid功能最完整的, 为了和Flex AdvancedDataGrid 区分，我叫它KAdvancedDataGrid。
KAdvancedDataGrid (http://code.google.com/p/advanceddatagrid/)
文章末尾是KadvancedDataGird的下载，相对于原版，我修复了如下内容:

动态使用columns = XXXX不起作用。
当列数据为复杂类型时异常。
设置dataProvider为null时异常。
还有一些其他的异常，忘了&#8230;..

KAdvancedDataGrid的使用很简单，使用groupedColumns标签，把想要合并的列放进去，他会自动的将相同内容的单元格合并在一起。
如下图：

本例的代码在文章末尾，测试代码很简单，这里就不过多解释了，大家可以下载测试。
KAdvancedDataGrid的应用展示
下面几张截图是我使用KadvancedDataGrid作为原材料制作的显示员工出勤情况的日历控件（Calendar View），包括Day, Week, Month和Year View.  这里显示的是Week, Month 和Year View. 使用前面的MecDataGrid或者NecGrid要想实现这样的DatGrid比较困难，Mec是灵活性不够，只能创建它固定格式的Grid, Nec是无法处理复杂数据类型。图片的分辨率较大，点击查看大图
Month View

Week View 

Year View

源代码
源代码中的AdvancedDataGrid是我修改后的版本，原版可访问http://code.google.com/p/advanceddatagrid/
]]></description>
			<content:encoded><![CDATA[<p>在项目中我们对DataGrid的要求是很高的，但很不幸的Flex 的DataGird的功能是很傻的，这就催生了AdvancedDatgrid, 它确实解决了很多DataGrid不能做的事，比如多级排序，单元格选择，树状显示数据，合并表头等，但是不知道为什么它确忘记了 “合并单元格”这么重要的事。好在牛人是很多的，于是出现了MecGrid, NecGrid这样不错的能解决单元格合并的DataGrid, 不过他们都各有缺点。</p>
<p><strong>MecGrid: （http://www.mechansp.com/index.php）</strong></p>
<p>1. 不支持itemrender。<br />
2. 单元格选择时无法获知整行数据。<br />
3. 不支持xxxFunction设置比如（labelFunction）<br />
4. 设置很不方便。在column设置中大量使用 number作为参数，非常非常的不利于使用，在线文档对这个ResourceXML的设置也没有提到具体细节，这个很头痛.</p>
<p>总结: MecGrid的使用非常不方便，而且完全不支持复杂数据类型，虽然实现了很多功能但都是固定功能，扩展性不强。这让他局限在只能作为表格使用。<br />
<strong>NEC Grid （http://www.necst.co.jp/product/ibiz/column/ibizblock/chap7.html）</strong></p>
<p><img class="alignnone size-full wp-image-636" title="nec" src="http://www.flextheworld.com/wp-content/uploads/2009/12/nec.jpg" alt="nec" width="356" height="346" /></p>
<p>1. 不能改变行高。<br />
2. 破换了itemrender的使用，我增加了一个ComboBox作为itemrender,但是他的显示完全不正常。如果itemrender的高度大于他的默认行高，显示会被切断。<br />
3. 不支持单元格选择。</p>
<p>总结：这个DataGrid的使用非常方便，不过缺点也比较明显，尤其是对itemrender这条，要命的是他不能改变行高，但实际中我们的数据是很有可能换行的。另外他居然不支持单元格选择，作为一个AdvancedDatagird,单元格选择在很多时候是必要的。总的来说这个DataGrid用于对数据操作没有特殊要求的用户是不错的选择。</p>
<p><span style="color: #ff0000;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-废话结束，教程开始的分割线&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span></p>
<p><span style="color: #ff0000;"><span id="more-633"></span><br />
</span></p>
<p>在看完了老美和日本人做的DataGrid后找到一个韩国人做的，名字就叫AdavcnedDataGrid, 相比Mec和Nec, 扩展的功能比较单一，Bug也非常多，只有合并单元格功能，基于Flex 的AdvancedDataGrid实现。不过也是保留原有 AdvancedDataGrid功能最完整的, 为了和Flex AdvancedDataGrid 区分，我叫它KAdvancedDataGrid。</p>
<p><strong>KAdvancedDataGrid (http://code.google.com/p/advanceddatagrid/)</strong></p>
<p>文章末尾是KadvancedDataGird的下载，相对于原版，我修复了如下内容:</p>
<ol>
<li>动态使用columns = XXXX不起作用。</li>
<li>当列数据为复杂类型时异常。</li>
<li>设置dataProvider为null时异常。</li>
<li>还有一些其他的异常，忘了&#8230;..</li>
</ol>
<p>KAdvancedDataGrid的使用很简单，使用groupedColumns标签，把想要合并的列放进去，他会自动的将相同内容的单元格合并在一起。</p>
<p>如下图：</p>
<p><img class="alignnone size-full wp-image-638" title="kad" src="http://www.flextheworld.com/wp-content/uploads/2009/12/kad.jpg" alt="kad" width="631" height="298" /></p>
<p>本例的代码在文章末尾，测试代码很简单，这里就不过多解释了，大家可以下载测试。</p>
<p><strong>KAdvancedDataGrid的应用展示</strong></p>
<p>下面几张截图是我使用KadvancedDataGrid作为原材料制作的显示员工出勤情况的日历控件（Calendar View），包括Day, Week, Month和Year View.  这里显示的是Week, Month 和Year View. 使用前面的MecDataGrid或者NecGrid要想实现这样的DatGrid比较困难，Mec是灵活性不够，只能创建它固定格式的Grid, Nec是无法处理复杂数据类型。图片的分辨率较大，点击查看大图</p>
<p><strong>Month View</strong></p>
<p><a href="http://www.flextheworld.com/wp-content/uploads/2009/12/monthview.gif" target="_blank"><img class="alignnone size-medium wp-image-641" title="monthview" src="http://www.flextheworld.com/wp-content/uploads/2009/12/monthview-300x287.gif" alt="monthview" width="300" height="287" /></a></p>
<p><strong>Week View </strong></p>
<p><a href="http://www.flextheworld.com/wp-content/uploads/2009/12/WeekView.jpg" target="_blank"><strong><img class="alignnone size-medium wp-image-642" title="WeekView" src="http://www.flextheworld.com/wp-content/uploads/2009/12/WeekView-300x65.jpg" alt="WeekView" width="300" height="65" /></strong></a></p>
<p><strong>Year View</strong></p>
<p><a href="http://www.flextheworld.com/wp-content/uploads/2009/12/yearView.gif" target="_blank"><strong><img class="alignnone size-medium wp-image-643" title="yearView" src="http://www.flextheworld.com/wp-content/uploads/2009/12/yearView-300x54.gif" alt="yearView" width="300" height="54" /></strong></a></p>
<p><strong>源代码</strong></p>
<p>源代码中的AdvancedDataGrid是我修改后的版本，原版可<strong>访问http://code.google.com/p/advanceddatagrid/</strong></p>
<p><strong><a class="downloadlink" href="http://www.flextheworld.com/wp-content/plugins/download-monitor/download.php?id=18" title=" downloaded 252 times" >mergeableDataGrid (252)</a><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.flextheworld.com/2009/12/flex-advanceddatagrid-rowspan.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
