﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-The NoteBook of EricKong-随笔分类-Flex</title><link>http://www.blogjava.net/jjshcc/category/46368.html</link><description>桑巴葡语翻译工作室是广州市最专业葡萄牙语翻译机构-www.puyufanyi.com-欢迎寻找Java,As400,Mainframe的猎头eric_cc#qq.ccom(把#换成@)</description><language>zh-cn</language><lastBuildDate>Tue, 18 Mar 2014 21:31:26 GMT</lastBuildDate><pubDate>Tue, 18 Mar 2014 21:31:26 GMT</pubDate><ttl>60</ttl><item><title>[Red5]Red5之Flash流媒体服务器的安装与使用教程完整版</title><link>http://www.blogjava.net/jjshcc/archive/2014/03/18/411173.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Tue, 18 Mar 2014 07:44:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2014/03/18/411173.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/411173.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2014/03/18/411173.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/411173.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/411173.html</trackback:ping><description><![CDATA[<div><span style="font-family: Verdana, Arial, Helvetica, sans-serif; line-height: normal; font-size: 12px; color: #9696ab; "><div id="mainContent" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 20px; padding-right: 20px; padding-bottom: 20px; padding-left: 20px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; line-height: 28px; color: #515050; "><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "><strong>Red5流媒体服务器简介</strong></p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">Red5是一个采用Java开发开源的Flash流媒体服务器。它支持：把音频（MP3）和视频（FLV）转换成播放流； 录制客户端播放流（只支持FLV）；共享对象；现场直播流发布；远程调用。Red5使用RSTP作为流媒体传输协议，在其自带的一些示例中演示了在线录制，flash流媒体播放，在线聊天，视频会议等一些基本功能。</p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "><strong>软件环境</strong></p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">既然是Java开发的，自然少不了要安装JDK，这里使用的是JDK6.x版本，Red5用的是0.9.1版本，Red5内嵌了Tomcat6.x服务器。为了测试和使用Red5，需要另外搭建开发环境，开发部署相应的服务端应用，开发IDE为Eclipse3.3.x + MyEclipse6.x（貌似版本有点低了，没办法，刚好电脑上安装程序，不想另外下载了，同时也够用了，哈哈），Web服务器为Tomcat6.x，最后客户端播放器使用Flowplayer3.2.x。以下是Red5和Flowplayer3.2.x下载地址。</p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">Red5下载：http://www.red5.org/downloads/<br />CuSunPlayer流媒体播放器下载：http://www.CuPlayer.com/CuSunPlayer/</p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "><strong>安装软件与环境配置</strong></p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "><strong>1.安装JDK。</strong>这里使用的是jdk-6u21-windows-i586.exe，双击按提示安装即可<br />&nbsp;</p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "><img alt="" src="http://www.cuplayer.com/player/uploads/allimg/130319/131G35195-0.png" data-pinit="registered" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /></p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">完毕后设置环境变量JAVA_HOME,PATH和CLASSPATH，如何设置环境变量请谷歌或百度</p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "><img width="673" height="259" alt="" src="http://www.cuplayer.com/player/uploads/allimg/130319/131S51F4-0.png" data-pinit="registered" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /><br /><div><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "><strong>2.安装Red5</strong></p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">因为是Windows环境，这里下载的是setup-Red5-0.9.1.exe。直接双击安装程序安装，安装过程中，需要填写服务器IP地址和端口，由于是本地测试，直接填写127.0.0.1，端口随意，不冲突即可，建议&gt;1024，这里使用5050。安装完之后不要忘记设置RED5_HOME环境变量。</p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "><img alt="" src="http://www.cuplayer.com/player/uploads/allimg/130319/131945N35-0.png" data-pinit="registered" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /></p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">Red5安装程序会默认把Red5注册为系统服务自动启动，打开系统服务，查看是否服务是否已经存在：</p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "><img data-pinit="registered" src="http://www.cuplayer.com/player/uploads/allimg/130319/1324131J6-0.png" alt="" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /></p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">我们看到服务已安装，但还没有启动，需要我们手动启动一下，选择Red5服务，鼠标右键，选择启动或者重新启动即可。系统界面操作，不赘述。如无意 外，应该可以正常启动。如果启动不了，请检查前面的环境变量设置是否设置完毕并且正确，最后检查Red5的启动日志文件，看看是否有相应的提示信息，日志 文件在Red5主目录下的log目录下，日志文件有多个，查看red5_service.log即可。启动后，打开浏览器，敲入安装Red5时的IP地址 和端口，正常情况下，看到如下信息，说明Red5已经正确安装了。</p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "><img alt="" src="http://www.cuplayer.com/player/uploads/allimg/130319/13255V128-0.png" data-pinit="registered" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /></p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">这个时候可以点击Install进入下载其官方提供的demo进行研究学习，安装后的demo文件在Red5根目录下的webapps下，如 D:\Red5\webapps。安装操作比较简单，这里不详细介绍，不过要这里要提醒一下，安装完的demo后，需要重新启动一下Red5服务器，重启 操作参考上面的介绍。<br /></p></div></p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "></p></div><div style="margin-top: 5px; margin-right: auto; margin-bottom: 10px; margin-left: auto; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; text-align: center; width: 500px; font-size: 14px; font-weight: bold; "><ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 12px; padding-right: 0px; padding-bottom: 12px; padding-left: 16px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; "><div><span style="color: #515050; font-weight: normal; line-height: 28px; "><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "><strong>3.安装配置开发环境</strong></p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">主要安装配置Eclipse3.3.x + MyEclipse6.x +Tomcat6.x。</p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">Eclipse下载的是eclipse3.3.1.zip，直接解压到D:\Program Files目录下；Tomcat下载apache-tomcat-6.0.36-windows-x86.zip,直接解压到D:\ProgramFiles目录即可；然后安装MyEclipse6.x，这里用的是MyEclipse_6.0.1GA_E3.3.1_Installer.exe,双击按提示安装完毕即可。</p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "><img alt="" src="http://www.cuplayer.com/player/uploads/allimg/130319/13294TS2-0.png" data-pinit="registered" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /><br /><div><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">配置Tomcat服务器和默认字符集为UTF-8</p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "><img alt="" src="http://www.cuplayer.com/player/uploads/allimg/130319/13320L157-0.png" data-pinit="registered" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /></p><p style="margin-top: 20px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">至此，软件的安装与环境配置完成，接下来就是开发和部署我们的流媒体服务器应用以及测试应用了。</p></div></p></span></div><li style="margin-top: 0px; margin-right: 6px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; float: left; font-family: Verdana, Arial, Helvetica, sans-serif, 宋体; line-height: 20px; "></li></ul></div></span></div><img src ="http://www.blogjava.net/jjshcc/aggbug/411173.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2014-03-18 15:44 <a href="http://www.blogjava.net/jjshcc/archive/2014/03/18/411173.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用ActionScript开发高级可视化组件-组件的实现</title><link>http://www.blogjava.net/jjshcc/archive/2011/07/09/353998.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Sat, 09 Jul 2011 10:00:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/07/09/353998.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/353998.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/07/09/353998.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/353998.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/353998.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;&nbsp;&nbsp;在用 ActionScript 创建自定义组件时,必须重载 UIComponent 类的一些方法.实现基本的组件结构,构造器,以及 createChildren(),commitProperties(), measure(), layoutChrome()和 updateDisplayList()方法. 基本组件结构下面例子展示了Flex 组件的基本...&nbsp;&nbsp;<a href='http://www.blogjava.net/jjshcc/archive/2011/07/09/353998.html'>阅读全文</a><img src ="http://www.blogjava.net/jjshcc/aggbug/353998.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-07-09 18:00 <a href="http://www.blogjava.net/jjshcc/archive/2011/07/09/353998.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用ActionScript开发高级可视化组件-关于创建高级组件</title><link>http://www.blogjava.net/jjshcc/archive/2011/07/09/353991.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Sat, 09 Jul 2011 09:37:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/07/09/353991.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/353991.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/07/09/353991.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/353991.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/353991.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 简单组件一般都是现存 Flex 组件的子类，它们通过设置 skpins 或 styles 属性来修改父组件的外观，或者添加一些新的功能。比如，为 Button 控件增加一个新的事件类型，或者更改<br />DataGrid 控件缺省的 styles 和 skins。<br />在高级组件中，通常会执行以下动作：&nbsp;<br />1.&nbsp; 更改已有组件的可视化外观或者可视化特性。 <br />2. 创建复合组件，将两个或者多个组件包装在其中。&nbsp;<br />3. 通过继承UIComponent 类来创建组件。 <br />&nbsp;&nbsp;&nbsp; 我们通常用继承现存类的方式来创建组件。比如，要创建基于 Button 的控件，我们就创建mx.controls.Button 类的一个子类。要开发自己的组件，则需要创建mx.core.UIComponent 类的子类。 <br /><strong>关于重载 UIComponent 类的 protected 方法<br />&nbsp;&nbsp;&nbsp; Flex 所有的可视化组件都是UIComponent 类的子类。 因此，可视化组件继承了 UIComponent类所定义的 methods，properties，events，styles 和 effects。 <br />&nbsp;&nbsp;&nbsp;&nbsp; 要创建高级的可视化组件，必须实现一个构造器（constructor）。另外要有选择性地重载下表中 UIComponent 类的一个或者多个 protected 方法：&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;commitProperties()&nbsp; 提交组件所有的属性变化。要么使属性同时更改，要么确保属性按照特定顺序设置。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;createChildren()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;创建组件的子组件。<br />&nbsp;&nbsp; &nbsp;比如，ComboBox 控件包含了一个 TextInput 控件和一个 Button 控件作为它的子组件。<br />&nbsp;&nbsp;&nbsp;&nbsp;LayoutChrome()&nbsp;&nbsp; 定义 Container 类的子类容器的 border 区域。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;measure()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;设置组件的缺省 size 和缺省的最小 size。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;updateDisplayList()&nbsp;&nbsp; 根据以前所设置的属性和样式来确定组件的子组件在屏幕上的大小（size）及位置（position） ，并且画出组件所使用的所有皮肤（ skins）及图形化元素。组件的父容器负责确定组件本身大小（size）。</strong>&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<strong> 组件的使用者不会直接调用所有这些方法。</strong>&nbsp;<br />关于失效(机制)的方法?<br />&nbsp;&nbsp;&nbsp;&nbsp; 在组件的生命周期中，应用可能会改变组件的大小和位置，更改组件的属性来控制组件的显示，或者更改组件的样式（styles）和皮肤（skin）属性。比如，可以更改组件中所显示的<br />文本(Text )的字体(Font)大小。 作为变更字体大小工作的一部分，组件的大小也可能随之发生变化，这就需要 Flex 去更新应用的布局。布局操作需要Flex 调用自定义组件的commitProperties(), measure(), layoutChrome(), 以及 updateDisplayList()方法。 <br />&nbsp;&nbsp;&nbsp; 应用通过程序来更改字体大小的执行速度大大快于 Flex 更新应用的速度。因此，你应该在确定最终要更改的字体之后再更新布局。&nbsp;另外一个场景就是，当你设置了组件的多个属性后，比如 Button 控件的 label 和 icon 属性，你肯定会想让所有属性被设置后一次性执行 commitProperties(), measure(), 和 updateDisplayList()方法，而不是设置过 label 属性后执行一遍这些方法，然后在设置 icon属性后又执行一次这些方法。 <br />&nbsp;&nbsp;&nbsp; 另外，可能有几个组件同时改变了它们的字体大小。这时应该让 Flex 去协调布局操作，以消除任何冗余过程，而不是在每个组件更新它的字体大小之后都执行一次布局操作。 <br />&nbsp;&nbsp;&nbsp;&nbsp; Flex 使用一种&#8220;失效机制（invalidation mechanism）&#8221;来同步组件的更改。<strong>Flex 用一系列方法的调用来标记组件的某些东西已经发生变化，并需要 Flex 去调用组件的commitProperties(), measure(), layoutChrome(),或者 updateDisplayList()方法。通过这种办法，Flex 实现了&#8220;失效机制&#8221; 。&nbsp;<br /></strong>&nbsp;&nbsp;&nbsp;&nbsp;下表描述了有关&#8220;失效(invalidation)&#8221;方法：&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>invalidateProperties()&nbsp;&nbsp; 通知组件，以使下次屏幕更新时，它的commitProperties()方法能被调用。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp; invalidateSize()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;通知组件，以使下次屏幕更新时，它的 measure()方法能被调用。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;invalidateDisplayList()&nbsp;&nbsp; 通知组件，以使下次屏幕更新时它的 layoutChrome()方法和updateDisplayList()方法能被调用。 <br /></strong>&nbsp;&nbsp;&nbsp; 当组件调用一个&#8220;失效&#8221;方法，它就通知 Flex，该组件已经被更新。当多个组件调用失效方法，Flex 会协调这些更新，以使这些更新操作下一次屏幕更新时一起执行。 <br />&nbsp;&nbsp;&nbsp; 通常，<strong>组件使用者不必直接调用这些&#8220;失效&#8221;方法。这些&#8221;失效&#8221;方法被组件的 setter 方法或者组件的其他方法在需要的时候调用.</strong>&nbsp;<br />&nbsp;<br /><strong>关于组件实例化的生命周期&nbsp;<br /></strong>&nbsp;&nbsp;&nbsp;&nbsp;组件实例化生命周期描述了用组件类创建组件对象时所发生的一系列步骤.作为生命周期的一部分,Flex 自动调用组件的方法,发出事件,并使组件可见。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;下面例子用 ActionScript 创建一个 Button 控件，并将其加入到容器之中：&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;//创建一个 Box 容器。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;var boxContainer:Box = new Box();&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;//设置 Box 容器&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&#8230;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;//创建 Button 控件。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;var b:Button = new Button()&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;//设置 button 控件。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;b.label = "Submit";&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;// 将 Button 添加到 Box 容器中。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;boxContainer.addChild(b); 下面的步骤显示了用代码创建一个 Button 控件，并将这个控件添加到 Box 容器中时所发生的一切：&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;1.&nbsp; 调用了组件的构造函数，如下面代码所示:&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;// Create a Button control.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;var b:Button = new Button()&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;2.&nbsp; 通过设置组件的属性对组件进行了设置,如下面代码所示:&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;// Configure the button control.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;b.label = "Submit";&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;组件的 setter 方法将会调用 invalidateProperties(), invalidateSize(), 或者invalidateDisplayList() 方法.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;3.&nbsp; 调用 addChild()方法将该组件添加到父组件中,如下代码所示:&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;// Add the Button control to the Box container.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;boxContainer.addChild(b);&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;Flex 执行以下动作:&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;4.&nbsp;&nbsp; 将 component 的 parent 属性设置为对父容器的引用.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;5.&nbsp; 计算组件的样式(style) 设置.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;6.&nbsp; 在组件上分发preinitialize 事件.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;7.&nbsp; 调用组件的createChildren() 方法.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;8.&nbsp; 调用invalidateProperties(), invalidateSize()和 invalidateDisplayList()方法以触发后续到来的,下一个&#8220;渲染事件&#8221;(render?event)期间对 commitProperties(), measure(),或 updateDisplayList()方法的调用。&nbsp;<br />&nbsp;&nbsp;&nbsp;<strong>&nbsp;这个规则唯一一个例外就是当用户设置组件的 height 和 width 属性时, Flex 不会调用measure() 方法.&nbsp;&nbsp;<br /></strong>&nbsp;&nbsp;&nbsp;&nbsp;9.&nbsp; 在组件上分发initialize 事件。此时，组件所有的子组件都被初始化，但是组件没有改更size 和处理布局。可以利用这个事件在组件布局之前执行一些附加的处理。&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;10. 在父容器上分发 childAdd 事件.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;11. 在父容器上分发initialize 事件.&nbsp; 12. 在下一个&#8220;渲染事件&#8221;(render?event)中, Flex 执行以下动作:&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;a.&nbsp; 调用组件的 commitProperties()方法.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;b.&nbsp; 调用组件的 measure()方法.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;c.&nbsp; 调用组件的 layoutChrome()方法.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;d.&nbsp; 调用组件的 updateDisplayList()方法.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;e.&nbsp; 在组件上分发 updateComplete 事件.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;13. 如果commitProperties(), measure()或者 updateDisplayList()方法调用了 invalidateProperties(),&nbsp;invalidateSize(),或 invalidateDisplayList()方法,则 Flexh 会分发另外一个 render 事件.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;14. 在最后的render 事件发生后, Flex 执行以下动作:&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;a.&nbsp; 通过设置组件的 visible 属性使组件变为可视.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;b.&nbsp; 在组件上分发 creationComplete 事件.组件的大小(size)和布局被确定.这个事件只在组件创建时分发一次.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;c.&nbsp; 在组件上分发 updateComplete 事件.无论什么时候,只要组件的布局(layout),位置,大小或其它可视的属性发生变化就会分发这事件,然后组件被更新，以使组件能够被正确地显示.&nbsp; <br />&nbsp;&nbsp;&nbsp; 当使用 addChild()方法将组件添加到容器中时,大部分工作都是为了设置这个组件.这是因为直到把组件添加到容器中时,Flex 才能确定它的大小(size),设置它所继承样式(style)属性,或者在屏幕上画出它. 也可以用 MXML，在应用中完成上面的组件添加动作,如下面的例子所示: <br />&lt;mx:Application xmlns:mx="<a href="http://www.adobe.com/2006/mxml">http://www.adobe.com/2006/mxml</a>"&gt; <br />&nbsp;&nbsp;&nbsp; &lt;mx:Box&gt; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;mx:Button label="Submit"/&gt; <br />&nbsp;&nbsp;&nbsp; &lt;/mx:Box&gt; <br />&lt;/mx:Application&gt;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;在 MXML 中创建组件时，Flex 执行的步骤顺序同用 ActionScript 的步骤顺序相同. 使用 removeChild() 方法可将组件从容器中移出， 如果对这个组件再没有其他的引用,那就相当于使用 Adobe Flash &nbsp;Player 或 Adobe AIR 的垃圾回收机制将组件从内存中删除. 关于创建组件的步骤&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;为了实现一个组件,就要重载组件的方法,定义新的属性,分发新的事件,或者执行其他任何应用所需的自定义的逻辑.要想实现自己的组件, 请遵循以下这些常规步骤:&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;1.&nbsp; 如果有必要，为组件创建所有的皮肤（skins） ．&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;2.&nbsp; 创建 ActionScript 类文件．&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;a.&nbsp; 从一个基类扩展，比如 UIComponent 或者其他的组件类．&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;b.&nbsp; 指定使用者能够通过 MXML 标记进行设置的属性．&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;c.&nbsp; 嵌入（Embed）所有的图片和皮肤文件．&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;d.&nbsp; 实现构造器．&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;e.&nbsp; 实现 UIComponent.createChildren()方法.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;f.&nbsp; 实现 UIComponent.commitProperties() 方法.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;g.&nbsp; 实现 UIComponent.measure() 方法.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;h.&nbsp; 实现 UIComponent.layoutChrome() 方法.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;i.&nbsp; &nbsp;实现 UIComponent.updateDisplayList() 方法.&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;j.&nbsp; 增加属性(properties),方法(methods),样式(styles),事件 （events）以及元数据．&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;3.&nbsp; 以 ActionScript 文件或者 SWC 文件的形式部署组件．&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;定义新组件时不一定要重载所有的方法．只需要重载实现组件功能所需的方法．如果创建现存组件的子类，比如 Button 控件或者 VBox 容器，那么必须实现组件中所添加的新功能所需<br />的方法．&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;例如：实现一个自定义的 Button 控件，该控件使用新的机制来定义缺省大小（size） ．在这种情况下，只需要重载 measure()方法．对于这个例子，参见实现 easure() 方法． <br />或者，要实现 VBox 容器的一个新子类．新子类利用 VBox 类已有的所有有关设定大小（sizing）的逻辑，但是变更了 VBox 类的布局逻辑以实现从底部到顶部的方式来布局容器中的<br />子控件，而不是自顶向下的布局．在这种情况下，只需要重载updateDisplayList()方法．关于这个例子，见实现 updateDisplayList()方法．<br />&nbsp;<br /><strong>关于接口&nbsp;<br /></strong><br />&nbsp;&nbsp;&nbsp;&nbsp;Flex 用接口将组件的基本功能分为离散的单元， 这使得它们可以被 &#8220;一块一块&#8221; 地实现． 例如，使组件可聚焦（有输入焦点） ，它必须实现 IFocusable 接口；要使它能够参与布局过程，它必须实现 ILayoutClient 接口． 为了简化接口的使用， UIComponent 类实现了下表中定义的所有接口，但是不包括IFocusManagerComponent 接口和 IToolTipManagerClient 接口．但 UIComponent 很多子类实现了 IFocusManagerComponent 和 IToolTipManagerClient 接口．&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;因此，创建 UIComponent 或其子类的子类，就不必实现这些接口．但是，如果要创建的组件不是 UIComponent 的子类，并且还想在 Flex 中使用这个组件，那么就必须实现一个或者多个接口。&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;注意：对于 Flex, Adobe 建议所有的组件都应从 UIComponent 及其子类继承.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<strong style="font-size: 10pt">下表列出了 Flex components 所实现的主要接口:&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;接口&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 用途&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;IChildList&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 表明容器中子控件的数量.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;IDeferredInstantiationUIComponent&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;表明组件或组件能实施延迟实例化.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;IFlexDisplayObject&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 指定皮肤元素的接口.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;IFocusManagerComponent&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 表明组件或者对象是可聚焦的,这意味着组件可以从 FocusManager 获取焦点.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;UIComponent&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;组件没有实现 Ifocusable 接口,因为有些组件不打算接受焦点.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;IInvalidating&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 表明组件或者对象能够使用&#8221;失效机制&#8221;去执行延迟的,而不是立即的属性提交( commitment), 度量(measurement), 以及画出(drawing) 或布局( layout).&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;ILayoutManagerClient&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;表明组件或者对象能够参与 LayoutManager 的提交(commit) ,度量(measure)和更新次序(update sequence)&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;IPropertyChangeNotifier&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;表明组件支持特定形式的事件传播.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;IRepeaterClient&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;表明组件或者对象能够被用于 Repeater 类.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;IStyleClient&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;表明组件能够从其他的对象继承样式,并且支持setStyle() 和 getStyle() 方法.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;IToolTipManagerClient&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 表明组件有一个 toolTip 属性,并且因此可以被ToolTipManager 所监控.&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;IUIComponent&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 定义组件能够成为布局管理器或列表的子组件所必须实现的基本 APIs. <br />&nbsp;&nbsp;&nbsp; IValidatorListener&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 表明组件能够监听校验(validation)事件,并且因此能够显示校验状态,比如一个红色边框和显示</strong><strong>校验错误的提示信息(tooltips)</strong>  <img src ="http://www.blogjava.net/jjshcc/aggbug/353991.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-07-09 17:37 <a href="http://www.blogjava.net/jjshcc/archive/2011/07/09/353991.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>创建 Flex 组件</title><link>http://www.blogjava.net/jjshcc/archive/2011/07/03/353584.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Sun, 03 Jul 2011 02:14:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/07/03/353584.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/353584.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/07/03/353584.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/353584.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/353584.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Flex 中的类体系结构Flex 包含大量的类，因而无法在本文中全部描述。不过，仔细查看一些类对了解 Flex 对象模型是非常有用的。图 1 显示了核心的类体系结构：图 1. Flex 的核心类体系结构&nbsp;最顶层的类是 DisplayObject，Flex 将它添加到 Flash Player 的 Stage 对象或通用显示列表。InteractiveObject 处理用户交互，包...&nbsp;&nbsp;<a href='http://www.blogjava.net/jjshcc/archive/2011/07/03/353584.html'>阅读全文</a><img src ="http://www.blogjava.net/jjshcc/aggbug/353584.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-07-03 10:14 <a href="http://www.blogjava.net/jjshcc/archive/2011/07/03/353584.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Flex 自定义组件外观</title><link>http://www.blogjava.net/jjshcc/archive/2011/07/02/353566.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Sat, 02 Jul 2011 14:55:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/07/02/353566.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/353566.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/07/02/353566.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/353566.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/353566.html</trackback:ping><description><![CDATA[<p sizset="90" sizcache="24"><a name="major4"><span class="atitle">动态按钮</span></a></p>
<p>动态按钮的的概念就是在鼠标悬停、鼠标点击、鼠标离开控件时，组件呈现不同的外观，这三种不同的外观可以通过背景位图图片，背景 SWF 文件实现。</p>
<p sizset="91" sizcache="24"><a name="minor4.1"><span class="smalltitle">位图实现</span></a></p>
<p>位图实现是将二进制图像文件作为控件背景，这里使用 Flex 的 Button 控件作为例子，通过定义 Button 的 upSkin、overSkin 以及 downSkin 样式分别设置鼠标离开 Button 时、鼠标悬停 Button 上方时以及鼠标点击 Button 时的皮肤，皮肤制作则使用 Embed 标签加载图片，使之成为 Class 对象，通过 Button 的 setStyle 方法将 Class 对象作为皮肤设置进去，清单 1 展示了其中设置 upSkin 的方法 .downSkin 和 overSkin 的设置方法相同。</p><br /><a name="listing1"><strong>清单 1. Button 控件设置 upSkin</strong></a><br />
<table cellspacing="0" cellpadding="0" width="100%" border="0" sizset="0" sizcache="2">
<tbody sizset="0" sizcache="1">
<tr>
<td class="code-outline"><pre class="displaycode">				 
 var btn:Button= &#8230; ; 
 [Embed(source="images/up.jpg", 
                    scaleGridTop="26", 
                    scaleGridBottom="64", 
                    scaleGridLeft="30", 
                    scaleGridRight="106")] 
 private var upSkin:Class; 
 btn.setStyle("upSkin",upSkin); 
</pre></td></tr></tbody></table><br />
<p>清单 1 中，Embed 标签内的 scaleGridTop、scaleGridBottom、scaleGridLeft、scaleGridRight 属性涉及到一种 Web 技术，名为九宫格的缩放技术，为了解释该技术，请先看图 1.</p><br /><a name="fig1"><strong>图 1. 九宫格原理图</strong></a><br />&nbsp;<img height="144" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/www.puyufanyi.com/image002.gif" width="216" border="0" longdesc="" /><br />
<p><br /><strong>注：原图是</strong><img height="20" alt="" src="http://www.ibm.com/developerworks/cn/web/1008_weiqiang_flexui/image003.gif" width="20" /><strong>，5 * 5 方格图，每个方格 4 个像素，上图是被放大后的效果</strong></p>
<p>图 1 在四条红线的位置把图片块成了 9 块，四个角，四条边和中间一块，在缩放的时候，四个角始终不变，两条横向边只缩放宽度，高度不变，两条纵向的边只缩放高度，宽度不变，中间一块宽和高同时缩放，这就是九宫格缩放的原理。这种技术一般是在使用图片做控件的皮肤时使用，很多控件的皮肤样式，在四个角的为位置是圆的或不规则的，所以使用这种缩放技术可以保证控件与图片的大小不一致的时候，图片看起来并不变形。</p>
<p>了解了九宫格技术再看 scaleGridTop、scaleGridBottom、scaleGridLeft、scaleGridRight 四个属性，它们分别代表图 1 中四条红色切割线的位置，scaleGridTop 代表横向顶部的切割线距离图像顶部的像素距离；scaleGridBottom 代表横向底部的切割线距离图像顶部的像素距离；scaleGridLeft 代表纵向左部的切割线距离图像左部的像素距离；scaleGridRight 代表纵向右部的切割线距离图像左部的像素距离。</p>
<p>通过上述技术和方法的使用，具体实例效果展示如图 2. 从左至右分别是 upSkin、downSkin、overSkin 的效果。</p><br /><a name="fig2"><strong>图 2. 位图实现效果展示图</strong></a><br />&nbsp;<img height="109" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/www.puyufanyi.com/image005.jpg" width="172" border="0" longdesc="" /><img height="110" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/www.puyufanyi.com/image007.jpg" width="148" border="0" longdesc="" /><img height="111" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/www.puyufanyi.com/image009.jpg" width="162" border="0" longdesc="" /><br />
<p sizset="95" sizcache="24"><a name="minor4.2"><span class="smalltitle">SWF 文件实现</span></a></p>
<p sizset="96" sizcache="24">SWF 文件实现就是用 SWF 文件中具体的某一帧（MoiveClip）作为控件皮肤，修改 <a href="http://www.ibm.com/developerworks/cn/web/1008_weiqiang_flexui/#_ 位图实现"><font color="#996699">位图实现</font></a>部分的 Embed 标签，构建的新的示例，如清单 2.</p><br /><a name="listing2"><strong>清单 2. 使用 SWF 具体某帧作为皮肤</strong></a><br />
<table cellspacing="0" cellpadding="0" width="100%" border="0" sizset="1" sizcache="2">
<tbody sizset="1" sizcache="1">
<tr>
<td class="code-outline"><pre class="displaycode">				 
 &lt;mx:Style&gt; 
      Button{ 
          up-skin:Embed(source="images/bg.swf",symbol="btnUP"); 
           over-skin:Embed(source="images/bg.swf",symbol="btnOVER"); 
           down-skin:Embed(source="images/bg.swf",symbol="btnDOWN"); 
        } 
 &lt;/mx:Style&gt; 
 &lt;mx:Button id="btn" label="Hello World" width="100" height="60"/&gt; 
</pre></td></tr></tbody></table><br />
<p>上面代码 Embed 中的 source 指向了一个 SWF 文件，没有与九宫格相关的布局属性，出现了新的属性：symbol，它是 SWF 文件中某一帧的标识符，意思是使用指定的帧作为皮肤。清单 2 的效果如图 3. 从左至右分别是 upSkin、downSkin、overSkin 的效果。</p><br /><a name="fig3"><strong>图 3. SWF 实现效果展示图</strong></a><br />&nbsp;<img height="107" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/www.puyufanyi.com/image011.jpg" width="191" border="0" longdesc="" /><img height="108" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/www.puyufanyi.com/image013.jpg" width="190" border="0" longdesc="" /><img height="108" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/www.puyufanyi.com/image015.jpg" width="196" border="0" longdesc="" /><br />
<p>这种特殊的 SWF 文件需要用到 Flash 开发工具，具体的开发方法读者可以查阅相关的 Flash 资料。</p>
<div class="ibm-alternate-rule">
<hr />
</div>
<p sizset="100" sizcache="24"><a name="major5"><span class="atitle">冒泡信息提示框</span></a></p>
<p>冒泡信息提示框是自定义的 ToolTip，传统的 Flex ToolTip 效果如图 4 所示。</p><br /><a name="fig4"><strong>图 4. 传统 ToolTip</strong></a><br />&nbsp;<img height="124" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/www.puyufanyi.com/image017.jpg" width="168" border="0" longdesc="" /><br />
<p>可以看到效果还是比较简陋的，为了增强用户体验，文章实现了新的 ToolTip 让其拥有冒泡效果，效果展示如图 5.</p><br /><a name="fig5"><strong>图 5. 冒泡 ToolTip</strong></a><br /><br />&nbsp;<img height="103" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/www.puyufanyi.com/image019.jpg" width="243" border="0" longdesc="" /><br />
<p>冒泡 ToolTip 的思想是新建名为 BubbleToolTip 的类，继承于 Canvas，实现 IToolTip 接口，IToolTip 是自定义 ToolTip 必须实现的接口。重写 BubbleToolTip 的 updateDisplayList 方法，目的是重新绘画 BubbleToolTip 的皮肤，皮肤的绘制依赖 BubbleToolTip 内部的 Graphics 对象，通过 this.graphics 语句可以获得该 Graphics 对象的引用，调用 Graphics 对象的 drawRoundRect 方法绘制冒泡的圆形，提示的具体内容则使用子对象 Canvas 存放。清单 3 是 BubbleToolTip 的 updateDisplayList 方法代码。</p><br /><a name="listing3"><strong>清单 3. BubbleToolTip 的 updateDisplayList 方法</strong></a><br />
<table cellspacing="0" cellpadding="0" width="100%" border="0" sizset="2" sizcache="2">
<tbody sizset="2" sizcache="1">
<tr>
<td class="code-outline"><pre class="displaycode">				 
 override protected function updateDisplayList( 
           unscaledWidth:Number, unscaledHeight:Number ) : void 
 {   
   super.updateDisplayList( unscaledWidth, unscaledHeight ); 
 
 
 this.graphics.clear(); 
 
    this.graphics.beginFill( getStyle('backgroundColor'), 1 ); 
    this.graphics.lineStyle(2, getStyle('borderColor'), 1); 
    this.graphics.drawRoundRect(0, 35, 6, 6, 24, 24); 
    this.graphics.endFill(); 
 
    this.graphics.beginFill( getStyle('backgroundColor'), 1 ); 
    this.graphics.lineStyle(2, getStyle('borderColor'), 1); 
    this.graphics.drawRoundRect(10, 25, 15, 15, 24, 24); 
    this.graphics.endFill(); 
 } 
</pre></td></tr></tbody></table><br />
<p>清单 3 的作用是绘画图 5 中黑色的两个圆圈，显示 Hello 信息的则是使用 Canvas 组件，该 Canvas 是在主 MXML 文件中定义，代码如清单 4 所示。</p><br /><a name="listing4"><strong>清单 4. 使用 BubbleToolTip 的 MXML 文件</strong></a><br />
<table cellspacing="0" cellpadding="0" width="100%" border="0" sizset="3" sizcache="2">
<tbody sizset="3" sizcache="1">
<tr>
<td class="code-outline"><pre class="displaycode">				 
 &lt;?xml version="1.0" encoding="utf-8"?&gt; 
 &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" 
 xmlns:component="component.*" backgroundGradientAlphas="[1.0, 1.0]" 
 backgroundGradientColors="[#FFFFFF, #FFFFFF]"&gt; 
 &lt;mx:Script&gt;&lt;![CDATA[ 
        import mx.events.ToolTipEvent; 
       import component.BubbleToolTip; 
        
        private function createCustomTip(title:String,event:ToolTipEvent):void { 
           var bt:BubbleToolTip = new BubbleToolTip(); 
           bt.text=title; 
           content.text = title; 
           bt.addChild(ppp); 
           ppp.visible=true; 
           event.toolTip = bt; 
        } 
        
        private function positionTip(event:ToolTipEvent):void{ 
            event.toolTip.x=event.currentTarget.x + event.currentTarget.width + 10; 
            event.toolTip.y=event.currentTarget.y;  
        } 
    ]]&gt;&lt;/mx:Script&gt; 

 &lt;mx:Button id="b1" 
        label="Hello world" x="60" y="60"
        toolTip=" " 
        toolTipCreate="createCustomTip('Hello World',event)"
        toolTipShow="positionTip(event)"
    /&gt; 
  &lt;mx:Canvas id="ppp" visible="false" width="50" height="40" cornerRadius="15" 
    borderColor="#000000" x="35" y="0" borderStyle="solid" borderThickness="2"&gt; 
    &lt;mx:Text id= "content" text="xixi" x="4.5" y="5" width="40" height="23.5"&gt; 
        
        &lt;/mx:Text&gt; 
        &lt;/mx:Canvas&gt; 
 &lt;/mx:Application&gt; 
</pre></td></tr></tbody></table><br />
<p>清单 4 中定义了存放信息的 Canvas ,id 为 ppp，首先设置 ppp 的 visible 为 false，不可见，在显示 ToolTip 的时候将 ppp 加到 BubbleToolTip 中，并且设置 ppp 为可见。设置 event.tooltip 为指定的 BubbleToolTip 对象。在 createCutomTip 方法中设置新的 ToolTip，在 positionTip 方法中定义 tooltip 的显示位置。</p>
<p sizset="105" sizcache="24">为了形象的表现出重写 updateDisplayList 方法前后的 BubbleToolTip 的对比，<a href="http://www.ibm.com/developerworks/cn/web/1008_weiqiang_flexui/#_ 图 _4._ 冒泡 ToolTip"><font color="#996699">图 5</font></a>显示的是重写后弹出的信息提示框，图 6 是不重写 updateDisplayList 的信息提示框，从两张图片可以看出重写后发生的变化。</p><br /><a name="N101A8"><strong>图 6. 不重写 updateDisplayList 方法的 BubbleToolTip</strong></a><br /><br /><img height="79" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/www.puyufanyi.com/image021.jpg" width="219" border="0" longdesc="" /><br />
<p>可以看到子对象的 Canvas 前后不变，因为并没有重写它的 updateDisplayList，而重写 BubbleToolTip 的 updateDisplayList 方法后边框变成了两个冒泡。注意 BubbleToolTip 对象实际上也是一个 Canvas。</p>
<div class="ibm-alternate-rule">
<hr />
</div>
<p sizset="108" sizcache="24"><a name="major6"><span class="atitle">网格背景</span></a></p>
<p>网格背景在一些 Flex 流程编辑器中可以看到，画布的网格背景不仅可以增强用户体验，对于流程编辑中的流程节点的对齐也有很大的帮助。</p>
<p>网格背景的容器使用画布 Canvas 对象，使用 CSS 重新定义容器的皮肤。定义新皮肤的 CSS 代码如清单 5.</p><br /><a name="listing5"><strong>清单 5. CSS 定义新皮肤 Canvas</strong></a><br />
<table cellspacing="0" cellpadding="0" width="100%" border="0" sizset="4" sizcache="2">
<tbody sizset="4" sizcache="1">
<tr>
<td class="code-outline"><pre class="displaycode">				 
 { 
 borderSkin: ClassReference("skins.GridSkin"); 
 }
</pre></td></tr></tbody></table><br />
<p><code>skins</code>.GridSkin 是一个 Flex 类，继承于 ProgrammaticSkin，ProgrammaticSkin 类代表编程式的皮肤定义，重写它的 updateDisplayList 方法可以设置新的皮肤，这和直接重写 Canvas 的 updateDisplayList 方法效果上是一致的，本文重在讲解新的定义方法，因此使用 CSS 定义。清单 6 显示网格定义的代码。</p><br /><a name="listing6"><strong>清单 6. ProgrammaticSkin 的 updateDisplayList 实现代码 </strong></a><br />
<table cellspacing="0" cellpadding="0" width="100%" border="0" sizset="5" sizcache="2">
<tbody sizset="5" sizcache="1">
<tr>
<td class="code-outline"><pre class="displaycode">				 
override protected function updateDisplayList(unscaledWidth:Number, 
unscaledHeight:Number):void {
 var g:Graphics = this.graphics; 
 g.clear(); 
 g.beginFill(0x000000, 0); 
 g.drawRect(0, 0, unscaledWidth, unscaledHeight); 
 g.endFill(); 
 g.lineStyle(1, 0x000000, 0.1); 
 var squareSize:Number = 15; 
 var numRows:Number = unscaledHeight / squareSize; 
 var numCols:Number = unscaledWidth / squareSize; 
 for(var row:Number = 0; row&lt; numRows; row++) { 
 g.moveTo(0, row * squareSize); 
 g.lineTo(unscaledWidth, row * squareSize); 
 } 
 for(var col:Number = 0; col&lt; numCols; col++) { 
 g.moveTo(col * squareSize, 0); 
 g.lineTo(col * squareSize, unscaledHeight); 
 } 
 } 
</pre></td></tr></tbody></table><br />
<p>清单 6 中的 unscaledWidth 和 unscaledHeight 代表了 Canvas 画布实际的宽和高，画布内的 Graphics 对象默认的绘画原点是画布左上角（0,0）点。代码 drawRect(0, 0, unscaledWidth, unscaledHeight) 用于绘画整个画布的边框，lineStyle(1, 0x000000, 0.1) 设置将要画的线的样式，黑色、透明度 0.1、粗细 1，squareSize 定义网格的大小（网格为正方形）。通过 unscaledHeight / squareSize 和 unscaledWidth / squareSize 获得画布允许的行数和列数，moveTo 移动绘画原点，lineTo 表示从原点到目标点画线。For 循环代表每画一行（列），原点向下（右）移动 squareSize 的距离，再从原点平行画直线到画布右边缘（底边缘）。那么网格效果就出来了 . 效果如图 7 所示 .</p><br /><a name="fig6"><strong>图 7. 网格背景效果</strong></a><br />&nbsp;<img height="342" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/www.puyufanyi.com/image023.jpg" width="333" border="0" longdesc="" /><br />
<p sizset="113" sizcache="24"><a name="major7"><span class="atitle">图像圆角</span></a></p>
<p>图像圆角是 Web2.0 重要的标志，如果你用过 CSS 进行圆角的开发，那么不管在开发过程中或者处理浏览器兼容问题时一定会大喊痛苦。然而在 Flex 中，图像圆角变的非常简单，使用 Mask 技术就可以轻松得实现。这种技术的直观感觉是将某一控件 A 覆盖在另一控件 B 之上，而 B 显示的部分则是被 A 遮盖的部分。如果 A 具有透明度，那么 B 也会有透明度。例子代码如清单 7. 所示。</p><br /><a name="N101F9"><strong>清单 7. 图像圆角组件</strong></a><br />
<table cellspacing="0" cellpadding="0" width="100%" border="0" sizset="6" sizcache="2">
<tbody sizset="6" sizcache="1">
<tr>
<td class="code-outline"><pre class="displaycode">			 &lt;?xml version="1.0" encoding="utf-8"?&gt;
 &lt;mx:Canvas 
    xmlns:mx="http://www.adobe.com/2006/mxml" 
    xmlns:filters="flash.filters.*"
    width="100%" height="100%" &gt; 

    &lt;mx:Image source="assets/ygy.jpg" x="10" y="10" mask="{maskCanvas}"&gt; 
        &lt;mx:filters&gt; 
            &lt;filters:DropShadowFilter /&gt; 
        &lt;/mx:filters&gt; 
    &lt;/mx:Image&gt; 
    
    &lt;mx:Canvas x="81" y="62" width="344" height="274" backgroundColor="#ff0000" 
    id="maskCanvas"  cornerRadius="15" borderStyle="solid"/&gt; 
    
 &lt;/mx:Canvas&gt; 
</pre></td></tr></tbody></table><br />
<p>清单 7 中图像圆角组件实际上是一个 Canvas，该组件内显示的是一个 Image（A），该 Image 指定 mask 为 maskCanvas，也就是一个 id 为 maskCanvas 的 Canvas（B），代码的意思是使用 B 遮盖 A，那么 B 的样式决定了 A 显示的样式，B 的样式中重要的是 backgroundColor 和 cornerRadius，backgroundColor 设置成红色，并不透明，cornerRadius 设置 B 的圆角（注意，Image 没有这个属性），那么使用深色的 B 遮盖 A，A 将显示被 B 遮盖的部分，也就是显示了图像的圆角，效果如图 8。</p><br /><a name="N10204"><strong>图 8. 图像圆角效果</strong></a><br />&nbsp;<img height="259" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/www.puyufanyi.com/image025.jpg" width="245" border="0" longdesc="" /><br />
<p>该效果使用的原图像如图 9 所示。这是一张方形的图像。<br /><a name="N10215"><strong>图 9. 原图像</strong></a><br />&nbsp;<img height="258" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/www.puyufanyi.com/image027.jpg" width="235" border="0" longdesc="" /></p>
<p>从清单 7 的 Design 视图可以看出 A 和 B 的遮盖结果，效果如图 10。</p><br /><a name="N10226"><strong>图 10. Design 视图</strong></a><br />&nbsp;<img height="274" alt="" src="http://www.blogjava.net/images/blogjava_net/jjshcc/www.puyufanyi.com/image029.jpg" width="237" border="0" longdesc="" /><br />
<p>原图像主要内容被红色背景的 Canvas 遮盖，四个角没被遮盖因此运行时则不被显示。运行后效果就会如图 8 所示了。</p><img src ="http://www.blogjava.net/jjshcc/aggbug/353566.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-07-02 22:55 <a href="http://www.blogjava.net/jjshcc/archive/2011/07/02/353566.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Using BlazeDS with Spring </title><link>http://www.blogjava.net/jjshcc/archive/2011/07/02/353557.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Sat, 02 Jul 2011 09:59:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/07/02/353557.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/353557.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/07/02/353557.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/353557.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/353557.html</trackback:ping><description><![CDATA[<div class="Semantic LayoutCellSides LayoutBreakAfter TextMedium">
<p>Flex is rapidly becoming the preferred technology for building groundbreaking internet applications delivered in the browser and on the desktop (using the AIR runtime). For several years, Spring has been one of the most popular frameworks for building the Java back-end of internet applications. In this article, we describe how to use BlazeDS Remoting to seamlessly integrate the two technologies and build state-of-the-art internet applications made of a Flex front-end and a Spring back-end.</p></div><a style="visibility: hidden" name="articlecontentAdobe_numberedheader"></a>
<div class="parbase compbase numberedheader section">
<h3 class="TextH3 LayoutCellSides LayoutRow">Getting started </h3></div><a style="visibility: hidden" name="articlecontentAdobe_text_0"></a>
<div class="text parbase section">
<div class="Semantic LayoutCellSides LayoutBreakAfter TextMedium">
<p>Whether you are a Flex developer with limited knowledge of Spring, or a Spring developer with limited knowledge of Flex, you can benefit from the powerful integration of these products. This section describes how BlazeDS enables a tight integration between Flex and Spring, and provides background information on the technologies at play.</p>
<h4>What is Spring?</h4>
<p>Spring is one of the most popular Java frameworks. The foundation of the Spring framework is a lightweight component container that implements the Inversion of Control (IoC) pattern. </p>
<p>Using an IoC container, components don't instantiate or even look up their dependencies (the objects they work with). The container is responsible for injecting those dependencies when it creates the components (hence the term "Dependency Injection" also used to describe this pattern). </p>
<p>The result is looser coupling between components. The Spring IoC container has proven to be a solid foundation for building robust enterprise applications. The components managed by the Spring IoC container are called Spring beans.</p>
<p>The Spring framework includes several other modules in addition to its core IoC container. These modules are not covered in this document even though we will be using the Spring JDBC abstraction framework in <a href="http://www.adobe.com/devnet/livecycle/articles/blazeds_spring.html#"><font color="#447099">the second sample application</font></a> below. More information on the Spring framework can be found at <a href="http://www.springframework.org/" target="_blank"><font color="#447099">http://www.springframework.org</font></a>.</p>
<h4>What is Flex?</h4>
<p>Flex is an environment for building Rich Internet Applications. The Flex programming model is made of: </p>
<ul><li><strong>ActionScript</strong>, an ECMAScript compliant, object-oriented programming model. With some syntactical differences, ActionScript looks and feels similar to Java, and supports the same object-oriented constructs: packages, classes, inheritance, interfaces, strong (but also dynamic) typing etc.</li><li><strong>MXML</strong>: an XML-based language that provides an abstraction on top of ActionScript, and allows parts of an application (typically the View) to be built declaratively.</li><li>An extensive set of <strong>class libraries</strong>. The <a href="http://www.adobe.com/devnet/livecycle/articles/blazeds_spring.html#"><font color="#447099">documentation</font></a> is available <a href="http://www.adobe.com/devnet/livecycle/articles/blazeds_spring.html#"><font color="#447099">here</font></a> in a Javadoc-like format. </li></ul>
<p>The Flex source code (.mxml and .as files) is compiled into Flash bytecode (.swf) that is executed at the client-side by the Flash virtual machine using a Just-In-Time compiler.</p>
<p>The Flex SDK is an open source project. It includes the Flex component library, the compiler, the debugger, and the documentation. A complete discussion of Flex is beyond the scope of this document. You can find more information and download the Flex SDK at <a href="http://opensource.adobe.com/" target="_blank"><font color="#447099">http://opensource.adobe.com</font></a>. </p>
<h4>What is BlazeDS?</h4>
<p>BlazeDS is a set of data services that give your Flex applications additional options for data connectivity. Without BlazeDS (or, without deploying any Flex-specific component at the server-side), Flex applications can access back-end data using either the HTTPService or the WebService:</p>
<ul><li>You use the <strong>HTTPService</strong> component to send HTTP requests to a server, and consume the response. Although the HTTPService is often used to consume XML, it can be used to consume other types of responses. The Flex HTTPService is similar to the XMLHttpRequest component available in Ajax.</li><li>You use the <strong>WebService</strong> component to invoke SOAP-based web services. </li></ul>
<p>BlazeDS adds the following services:</p>
<ul><li>The <strong>Remoting Service</strong> allows your Flex application to directly invoke methods of Java objects deployed in your application server.</li><li>The <strong>Message Service</strong> provides a publish/subscribe infrastructure that enables your Flex application to publish messages and subscribe to a messaging destination, enabling the development of real-time data push and collaborative applications.</li><li>The <strong>Proxy Service</strong> allows your Flex application to make cross-domain service requests in a secure and controlled manner. In other words, it allows your Flex application to access a service available on a different domain than the domain from where the application was downloaded (without having to deploy a crossdomain.xml policy file on the target domain). </li></ul>
<p>BlazeDS is deployed as a set of JAR files as part of your web application. Like the Flex SDK, BlazeDS is an open-source project. More information is available at <a href="http://opensource.adobe.com/" target="_blank"><font color="#447099">http://opensource.adobe.com</font></a>.</p>
<p>In this document, we focus on the Remoting service. The Remoting Service provides a tight and natural integration with Spring. There is no need to transform data, or to expose services in a certain way: the Flex application can directly access the beans registered in the Spring IoC container.</p>
<h4>How does Flex use BlazeDS to access Spring beans? </h4>
<p>So, if Flex clients can remotely access Java objects, and if Spring beans are Java objects, aren't we all set and ready to start accessing Spring beans from Flex clients? Almost&#8230; There is one simple element to configure. </p>
<p>The whole idea behind Spring IoC is to let the container instantiate components (and inject their dependencies). By default, however, components accessed remotely by a Flex client are instantiated by BlazeDS on the server. The key to the Flex/Spring integration, therefore, is to configure BlazeDS to let the Spring container take care of instantiating Spring beans. BlazeDS supports the concept of a factory to enable this type of custom component instantiation. The role of a factory is simply to provide ready-to-use instances of components to BlazeDS (instead of letting BlazeDS instantiate these components). </p>
<p>The supporting files available with this article include a factory class (SpringFactory) that provides BlazeDS with fully initialized (dependency-injected) instances of Spring beans. Note: The SpringFactory was developed by Jeff Vroom (Flex Data Services architect) and is also available on <a href="http://www.adobe.com/exchange.html"><font color="#447099">Adobe Exchange</font></a>.</p>
<p>The remainder of this article describes how to configure your web application to use BlazeDS and Spring, how to configure the Spring Factory, and how to put the pieces together and start invoking Spring beans from Flex applications. </p></div></div><a style="visibility: hidden" name="articlecontentAdobe_numberedheader_0"></a>
<div class="parbase compbase numberedheader section">
<h3 class="TextH3 LayoutCellSides LayoutRow">Setting up your environment </h3></div><a style="visibility: hidden" name="articlecontentAdobe_text_1"></a>
<div class="text parbase section">
<div class="Semantic LayoutCellSides LayoutBreakAfter TextMedium">
<p>Configuring your web application is simple and merely requires installing and registering the necessary components.</p>
<h4>Step 1: Install the BlazeDS turnkey server</h4>
<p>The BlazeDS turnkey server is a ready-to-use version of Apache <a href="http://tomcat.apache.org/index.html" target="_blank"><font color="#447099">Tomcat</font></a> in which the Blaze data services have already been deployed along with sample applications. The goal of the turnkey server is to give developers an easy way to run samples and tutorials out of the box.</p>
<h5>To install the BlazeDS turnkey server:</h5>
<ol><li>Make sure that you have the JDK 1.5 or higher installed, and that you have a JAVA_HOME environment variable pointing to your Java Development Kit installation.</li><li>Download blazeds-turnkey-&lt;version&gt;.zip.</li><li>Unzip blazeds-turnkey-&lt;version&gt;.zip in /blazeds. 
<p class="caption"><strong>Note.</strong>You can unzip blazeds-turnkey-&lt;version&gt;.zip anywhere else. Just make sure you adjust the path in the instructions provided in this document accordingly.</p></li><li>Start the samples database. 
<ol type="a"><li>Open a command prompt.</li><li>Navigate to /blazeds/sampledb.</li><li>Execute startdb.bat (Windows) or startdb.sh (Unix-based systems) </li></ol></li><li>Start Tomcat. 
<ol type="a"><li>Open a command prompt.</li><li>Navigate to /blazeds/tomcat/bin.</li><li>Execute the following command: <br /></li></ol></li></ol></div></div><a style="visibility: hidden" name="articlecontentAdobe_codeblock"></a>
<div class="parbase codeblock compbase section">
<div class="PanelFillLight PanelBevelTop LayoutCell LayoutRow"><code class="CodeBlock">catalina run</code> </div></div><a style="visibility: hidden" name="articlecontentAdobe_text_2"></a>
<div class="text parbase section">
<div class="Semantic LayoutCellSides LayoutBreakAfter TextMedium">
<ol type="a" start="4"><li>Access http://localhost:8400/samples to make sure the installation is successful: you should see the BlazeDS samples home page. </li></ol>
<p>As an alternative to using the turnkey server, you could use one of the following options:</p>
<ol><li>Download <strong>blazeds-&lt;version&gt;.war</strong> and deploy it in your own application server. Blazeds-&lt;version&gt;.war is a blank web application configured to use the BlazeDS data services. 
<p class="caption"><strong>Note:</strong> <strong>samples-&lt;version&gt;.war</strong> includes everything included in blazeds.war, plus a series of samples.</p></li><li>Download blazeds-&lt;version&gt;.war and merge its content in your own web application. </li></ol>
<p>The instructions in this document assume that you use the BlazeDS turnkey server. If you are using one of the alternative options, you will have to adjust the instructions accordingly.</p>
<h4>Step 2: Install the Flex SDK</h4>
<p>You need the Flex compiler to compile the client-side (Flex-side) of the sample applications discussed in this document. The Flex compiler is part of the Flex SDK. As a convenience, the Flex SDK is available as part of the BlazeDS installation in blazeds/resources/flex_sdk/flex_sdk_3.zip.</p>
<p class="caption"><strong>Note:</strong> The Flex SDK can also be downloaded at <a href="http://opensource.adobe.com/" target="_blank"><font color="#447099">http://opensource.adobe.com</font></a>. It is also available as part of Flex Builder.</p>
<h4>To install the Flex SDK:</h4>
<p><em>You can skip this step if Flex Builder 3 is installed on your system.</em></p>
<p>Unzip /blazeds/resources/flex_sdk/flex_sdk_3.zip in /flex_sdk_3.</p>
<p class="caption"><strong>Note:</strong> You can unzip flex_sdk_3.zip anywhere else. Just make sure you adjust the path in the instructions provided in this document accordingly.</p>
<h4>Step 3: Install Spring</h4>
<p class="caption"><strong>Note:</strong> A complete discussion of the Spring installation process is beyond the scope of this article. Refer to <a href="http://www.springframework.org/" target="_blank"><font color="#447099">http://www.springframework.org</font></a> for more information. The steps below describe a basic configuration that is sufficient for the purpose of this article.</p>
<ol><li>Download the Spring framework at <a href="http://www.springframework.org/download" target="_blank"><font color="#447099">http://www.springframework.org/download</font></a> (the version without dependencies is sufficient to complete the examples in this article). 
<p class="caption"><strong>Note:</strong> The examples below have been developed and tested using Spring 2.x. However the integration approach described in this document (and the SpringFactory class) should work fine using Spring 1.2.8 (some of the examples might not work because they use Spring 2.x features).</p></li><li>Unzip the downloaded file.</li><li>Locate spring.jar in the dist directory and copy the file to /blazeds/tomcat/webapps/blazeds/WEB-INF/lib</li><li>Open /blazeds/tomcat/webapps/blazeds/WEB-INF/web.xml and add the <strong>context-param</strong> and <strong>listener</strong> definitions as follows: </li></ol></div></div><a style="visibility: hidden" name="articlecontentAdobe_codeblock_0"></a>
<div class="parbase codeblock compbase section">
<div class="PanelFillLight PanelBevelTop LayoutCell LayoutRow"><code class="CodeBlock">&lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt; &lt;/context-param&gt; &lt;listener&gt; &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener &lt;/listener-class&gt; &lt;/listener&gt;</code> </div></div><a style="visibility: hidden" name="articlecontentAdobe_text_3"></a>
<div class="text parbase section">
<div class="Semantic LayoutCellSides LayoutBreakAfter TextMedium">
<h4>Step 4: Install the supporting files</h4>
<ol><li>Download flex-spring.zip <a href="http://download.macromedia.com/pub/developer/flex_spring.zip"><font color="#447099">here</font></a></li><li>Unzip flex-spring.zip in /flex-spring </li></ol>
<p>Flex-spring.zip includes the Spring factory as well as the supporting files for the examples below.</p>
<h4>Step 5: Register the Spring factory</h4>
<ol><li>Copy SpringFactory.class and SpringFactory$SpringFactoryInstance.class from /flex-spring/factory/bin/flex/samples/factories to /blazeds/tomcat/webapps/blazeds/WEB-INF/classes/flex/samples/factories.</li><li>Register the Spring factory in /blazeds/tomcat/webapps/blazeds/WEB-INF/flex/services-config.xml: </li></ol></div></div><a style="visibility: hidden" name="articlecontentAdobe_codeblock_1"></a>
<div class="parbase codeblock compbase section">
<div class="PanelFillLight PanelBevelTop LayoutCell LayoutRow"><code class="CodeBlock">&lt;factories&gt; &lt;factory id="spring" class="flex.samples.factories.SpringFactory"/&gt; &lt;/factories&gt;</code> </div></div><a style="visibility: hidden" name="articlecontentAdobe_numberedheader_1"></a>
<div class="parbase compbase numberedheader section">
<h3 class="TextH3 LayoutCellSides LayoutRow">Example 1: Mortgage calculator </h3></div><a style="visibility: hidden" name="articlecontentAdobe_text_4"></a>
<div class="text parbase section">
<div class="Semantic LayoutCellSides LayoutBreakAfter TextMedium">
<p>This first application is intentionally simplistic to provide an uncluttered example of wiring Spring beans together and invoking them from a Flex application.</p>
<h4>Step 1: Examine the application source code</h4>
<ol><li>Examine the Flex source code:<br />Open MortgageCalc.mxml located in /flex-spring/samples/mortgage/flex in a code editor to familiarize yourself with the application. The application enables the user to enter a mortgage amount. When the user clicks the "Calculate" button, the application obtains the value of the monthly payment for that mortgage by invoking the <kbd>calculate()</kbd> method of the remote object identified by a logical name: "mortgageService". "mortgageService" is mapped to a fully qualified Java class name in the remoting-config.xml file (see Step 3 below).</li><li>Examine the Java source code:<br />Open RateFinder.java, SimpleRateFinder.java and Mortgage.java located in /flex-spring/samples/mortgage/java in a code editor. Notice that Mortgage has a dependency to a RateFinder object. Mortgage doesn't instantiate a RateFinder object itself, doesn't lookup up for a RateFinder object, and doesn't even know the exact type of the object it will be dealing with (RateFinder is an inteface). An instance of a class implementing the RateFinder interface will be injected by the container (using the setRateFinder method) when it instantiates the component (see step 2 below). </li></ol>
<h4>Step 2: Register Spring beans</h4>
<ol><li>If it doesn't already exist, create a file named applicationContext.xml in /blazeds/tomcat/webapps/blazeds/WEB-INF.</li><li>Register the rateFinderBean and mortgageBean beans in applicationContext.xml as follows: </li></ol></div></div><a style="visibility: hidden" name="articlecontentAdobe_codeblock_2"></a>
<div class="parbase codeblock compbase section">
<div class="PanelFillLight PanelBevelTop LayoutCell LayoutRow"><code class="CodeBlock">&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"&gt; &lt;beans&gt; &lt;bean id="rateFinderBean" class="flex.samples.spring.mortgage.SimpleRateFinder"/&gt; &lt;bean id="mortgageBean" class="flex.samples.spring.mortgage.Mortgage"&gt; &lt;property name="rateFinder" ref="rateFinderBean"/&gt; &lt;/bean&gt; &lt;/beans&gt;</code> </div></div><a style="visibility: hidden" name="articlecontentAdobe_text_5"></a>
<div class="text parbase section">
<div class="Semantic LayoutCellSides LayoutBreakAfter TextMedium">
<p>Notice that in the mortgageBean definition, we tell the container how to inject the rateFinder dependency: the <kbd>rateFinder</kbd> property is mapped to <kbd>rateFinderBean</kbd>, which defines an instance of the SimpleRateFinder class.</p>
<h4>Step 3: Configure the Flex Remoting destination</h4>
<ol><li>Open remoting-config.xml in /blazeds/tomcat/webapps/blazeds/WEB-INF/flex.</li><li>Add a mortgageService destination as follows: </li></ol></div></div><a style="visibility: hidden" name="articlecontentAdobe_codeblock_3"></a>
<div class="parbase codeblock compbase section">
<div class="PanelFillLight PanelBevelTop LayoutCell LayoutRow"><code class="CodeBlock">&lt;destination id="mortgageService"&gt; &lt;properties&gt; &lt;factory&gt;spring&lt;/factory&gt; &lt;source&gt;mortgageBean&lt;/source&gt; &lt;/properties&gt; &lt;/destination&gt;</code> </div></div><a style="visibility: hidden" name="articlecontentAdobe_text_6"></a>
<div class="text parbase section">
<div class="Semantic LayoutCellSides LayoutBreakAfter TextMedium">
<p>Notice that we use the Spring factory defined above (see "Register the Spring Factory"), and we provide the name of the Spring bean as defined in applicationContext.xml as the source.</p>
<h4>Step 4: Build the project</h4>
<p>The Flex SDK includes ANT tasks that make it easy to compile Flex applications and create HTML pages to host them as part of a build process. The support files include build scripts to compile and deploy each sample application.</p>
<p class="caption"><strong>Note:</strong> You need the Apache Ant build tool to build and deploy your applications as described in this document. If Apache Ant is not installed on your system, visit <a href="http://ant.apache.org/" target="_blank"><font color="#447099">http://ant.apache.org</font></a> and follow the download and installation instructions.</p>
<h5>To build the Mortgage Calculator project:</h5>
<ol><li>Edit /flex-spring/samples/mortgage/build.xml: 
<ol type="a"><li>Make sure the FLEX_HOME property points to the location of the Flex SDK on your system.</li><li>Make sure the CONTEXT_ROOT property matches the context root of your web application. </li></ol></li><li>Open a command prompt.</li><li>Navigate to /flex-spring/samples/mortgage.</li><li>Execute the following command to compile and deploy the client and server of the application:<br /><code>ant</code> 
<p>The build process deploys the client side of the application (the compiled flex application) in /blazeds/tomcat/webapps/blazeds/mortgage and the server side (the compiled Java classes) in /blazeds/tomcat/webapps/blazeds/WEB-INF/classes/flex/samples/spring/mortgage.</p></li></ol>
<h4>Step 5: Run the client application</h4>
<ol><li>Restart Tomcat.</li><li>Open a browser, access http://localhost:8400/blazeds/mortgage/index.html, and test the application: Enter a loan amount and click "Calculate" to get the monthly payment for a 30-year mortgage.<br /></li></ol></div></div><a style="visibility: hidden" name="articlecontentAdobe_numberedheader_2"></a>
<div class="parbase compbase numberedheader section">
<h3 class="TextH3 LayoutCellSides LayoutRow">Example 2: Store/inventory management using Flex Remoting </h3></div><a style="visibility: hidden" name="articlecontentAdobe_text_7"></a>
<div class="text parbase section">
<div class="Semantic LayoutCellSides LayoutBreakAfter TextMedium">
<p>This second example is more sophisticated and includes database connectivity. To keep the application simple and avoid dependencies on other products or frameworks, the Spring JDBC abstraction framework is used to access the database. You could use the Spring support for ORM data access (using Hibernate, JDO, Oracle TopLink, iBATIS, or JPA) as an alternative: the specific Spring data access strategy you choose has no impact on the Flex/Spring integration. This sample application has two modules: a database maintenance module (storeadmin) and a customer-facing product catalog with filtering capabilities (store).</p>
<h4>Step 1: Examine the application source code</h4>
<ol><li>Examine the Flex source code: 
<p>Open store.mxml located in /flex-spring/samples/store/flex in a code editor to familiarize yourself with the store application. Notice the RemoteObject declaration pointing to the "productService" destination. "productService" is mapped to a Spring bean in Step 3 below. When the application starts, it invokes the findAll() method on the remote bean to retrieve the list of products (see the createComplete event on the Application tag).</p>
<p>Open storeadmin.mxml and ProductForm.mxml located in /flex-spring/samples/store/flex in a code editor to familiarize yourself with the storeadmin application. Notice that the storeadmin application uses the same remote Spring bean (productService) as the store application to retrieve the list of products using the findAll() method, and update changes using the updateProduct() method.</p></li><li>Examine the Java source code: 
<p>Open ProductDAO.java, SimpleProductDAO.java and Product.java located in /flex-spring/samples/store/java in a code editor. Notice that SimpleProductDAO extends org.springframework.jdbc.core.support.JdbcDaoSupport. JdbcDaoSupport has a dependency to a javax.sql.DataSource object (javax.sql.DataSource is an interface).</p></li></ol>
<h4>Step 2: Register Spring beans</h4>
<ol><li>Register the dataSource and productDAOBean beans in applicationContext.xml as follows: </li></ol></div></div><a style="visibility: hidden" name="articlecontentAdobe_codeblock_4"></a>
<div class="parbase codeblock compbase section">
<div class="PanelFillLight PanelBevelTop LayoutCell LayoutRow"><code class="CodeBlock">&lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName" value="org.hsqldb.jdbcDriver"/&gt; &lt;property name="url" value=" jdbc:hsqldb:hsql://localhost:9002/flexdemodb"/&gt; &lt;property name="username" value="sa"/&gt; &lt;property name="password" value=""/&gt; &lt;/bean&gt; &lt;bean id="productDAOBean" class="flex.samples.spring.store.SimpleProductDAO"&gt; &lt;property name="dataSource" ref="dataSource"/&gt; &lt;/bean&gt; </code></div></div><a style="visibility: hidden" name="articlecontentAdobe_text_8"></a>
<div class="text parbase section">
<div class="Semantic LayoutCellSides LayoutBreakAfter TextMedium">
<ol start="2"><li>Copy hsqldb.jar from blazeds/tomcat/webapps/samples/WEB-INF/lib to /blazeds/tomcat/webapps/blazeds/WEB-INF/lib. </li></ol>
<h4>Step 3: Configure the Flex Remoting destination</h4>
<ol><li>Open remoting-config.xml in /blazeds/tomcat/webapps/blazeds/WEB-INF/flex.</li><li>Add the productService destination as follows: </li></ol></div></div><a style="visibility: hidden" name="articlecontentAdobe_codeblock_5"></a>
<div class="parbase codeblock compbase section">
<div class="PanelFillLight PanelBevelTop LayoutCell LayoutRow"><code class="CodeBlock">&lt;destination id="productService"&gt; &lt;properties&gt; &lt;factory&gt;spring&lt;/factory&gt; &lt;source&gt;productDAOBean&lt;/source&gt; &lt;/properties&gt; &lt;/destination&gt;</code> </div></div><a style="visibility: hidden" name="articlecontentAdobe_text_9"></a>
<div class="text parbase section">
<div class="Semantic LayoutCellSides LayoutBreakAfter TextMedium">
<h4>Step 4: Build the project</h4>
<ol><li>Edit /flex-spring/samples/store/build.xml: 
<ol type="a"><li>Make sure the FLEX_HOME property points to the location of the Flex SDK on your system.</li><li>Make sure the CONTEXT_ROOT property matches the context root of your web application. </li></ol></li><li>Open a command prompt.</li><li>Navigate to /flex-spring/samples/store.</li><li>Execute the following command to compile and deploy the client-side and the server side of the application: <code>ant</code> 
<p>The build process deploys the client-side of the store and storeadmin applications in /blazeds/tomcat/webapps/blazeds/store and /blazeds/tomcat/webapps/blazeds/storeadmin respectively, and the server-side (the compiled Java classes) in /blazeds/tomcat/webapps/blazeds/WEB-INF/classes/flex/samples/spring/store.</p></li></ol>
<h4>Step 5: Run the client application</h4>
<ol><li>Restart Tomcat</li><li>Open a browser, access http://localhost:8400/blazeds/storeadmin/index.html, and test the storeadmin application.</li><li>Open a browser, access http://localhost:8400/blazeds/store/index.html, and test the store application. </li></ol></div></div><img src ="http://www.blogjava.net/jjshcc/aggbug/353557.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-07-02 17:59 <a href="http://www.blogjava.net/jjshcc/archive/2011/07/02/353557.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>BlazeDS with Remote Objects example</title><link>http://www.blogjava.net/jjshcc/archive/2011/07/02/353551.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Sat, 02 Jul 2011 08:59:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/07/02/353551.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/353551.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/07/02/353551.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/353551.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/353551.html</trackback:ping><description><![CDATA[<p>In my previous tutorial on BlazeDS, I went over an example over how to setup remote objects with data push. There are however, a lot of instances where someone just wanted to receive data and they aren&#8217;t concerned with it being updated., so it turns more into a &#8216;client requesting data whenever it wants it&#8217; scenario. This article will not be nearly as indepth as the last blazeDS article, but if you have not setup your environment for BlazeDS before, it will probably be in your best interest to check it <a href="http://codeofdoom.com/wordpress/2009/01/29/blazeds-data-push-with-remote-objects/">out</a>.<br /><span id="more-82"></span><br />Lets begin by making sure that we have our server and BlazeDs war file. Both of them can be found here:</p>
<p><a href="http://tomcat.apache.org/download-60.cgi" modo="false">Tomcat 6</a><br /><a href="http://flexorg.wip3.adobe.com/blazeds/3.0.x/milestone/3978/blazeds-bin-3.2.0.3978.zip" modo="false">BlazeDS</a></p>
<p>Once again, we are going to extract the contents into our BlazeDS server project. This time, we are only going to edit remoting-config.xml. Make sure that the following lines are in there.</p>
<div class="wp_syntax">
<div class="code"><pre class="xml" style="font-family: monospace"><span style="color: #009900"><span style="font-weight: bold; color: #000000">&lt;default-channels<span style="font-weight: bold; color: #000000">&gt;</span></span></span>
   <span style="color: #009900"><span style="font-weight: bold; color: #000000">&lt;channel</span> <span style="color: #000066">ref</span>=<span style="color: #ff0000">"my-amf"</span><span style="font-weight: bold; color: #000000">/&gt;</span></span>
<span style="color: #009900"><span style="font-weight: bold; color: #000000">&lt;/default-channels<span style="font-weight: bold; color: #000000">&gt;</span></span></span>
<span style="color: #009900"><span style="font-weight: bold; color: #000000">&lt;destination</span> <span style="color: #000066">id</span>=<span style="color: #ff0000">"BlazeDsService"</span><span style="font-weight: bold; color: #000000">&gt;</span></span> 
  <span style="color: #009900"><span style="font-weight: bold; color: #000000">&lt;properties<span style="font-weight: bold; color: #000000">&gt;</span></span></span> 
     <span style="color: #009900"><span style="font-weight: bold; color: #000000">&lt;source<span style="font-weight: bold; color: #000000">&gt;</span></span></span>com.codeofdoom.BlazeDsService<span style="color: #009900"><span style="font-weight: bold; color: #000000">&lt;/source<span style="font-weight: bold; color: #000000">&gt;</span></span></span> 
  <span style="color: #009900"><span style="font-weight: bold; color: #000000">&lt;/properties<span style="font-weight: bold; color: #000000">&gt;</span></span></span> 
<span style="color: #009900"><span style="font-weight: bold; color: #000000">&lt;/destination<span style="font-weight: bold; color: #000000">&gt;</span></span></span></pre></div></div>
<p>We tell the remoting-config to use the channel &#8220;my-amf&#8221;, which is already defined with the services-config.xml file. Next we are telling it to use the the destination &#8220;BlazeDsService&#8221;. This is what our remote object will be looking at. The properties also contains a source. This source is going to be a java class with the methods it needs in order to process the calls from the front end. You must make sure you include the fully qualified name, so we will call it com.codeofdoom.BlazeDsService. So what does this file look like?</p>
<div class="wp_syntax">
<table>
<tbody>
<tr>
<td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td>
<td class="code" style="width: 1394px; height: 440px"><pre class="java" style="font-family: monospace"><span style="font-weight: bold; color: #000000">package</span> <span style="color: #006699">com.codeofdoom</span><span style="color: #339933">;</span>
&nbsp;
<span style="font-weight: bold; color: #000000">import</span> <span style="color: #006699">java.util.ArrayList</span><span style="color: #339933">;</span>
<span style="font-weight: bold; color: #000000">import</span> <span style="color: #006699">java.util.List</span><span style="color: #339933">;</span>
<span style="font-weight: bold; color: #000000">import</span> <span style="color: #006699">java.util.Random</span><span style="color: #339933">;</span>
<span style="font-weight: bold; color: #000000">import</span> <span style="color: #006699">flex.messaging.io.ArrayCollection</span><span style="color: #339933">;</span>
&nbsp;
<span style="font-weight: bold; color: #000000">public</span> <span style="font-weight: bold; color: #000000">class</span> BlazeDsService <span style="color: #009900">{</span>
    <span style="font-weight: bold; color: #000000">private</span> <span style="font-weight: bold; color: #000000">static</span> <span style="font-weight: bold; color: #000000">final</span> <span style="color: #003399">String</span><span style="color: #009900">[</span><span style="color: #009900">]</span> MASTER_LIST <span style="color: #339933">=</span> <span style="color: #009900">{</span><span style="color: #0000ff">"C"</span>, <span style="color: #0000ff">"FNM"</span>, <span style="color: #0000ff">"FRE"</span>, <span style="color: #0000ff">"F"</span>, <span style="color: #0000ff">"GOOG"</span>, <span style="color: #0000ff">"AIG"</span>, <span style="color: #0000ff">"CSCO"</span>, <span style="color: #0000ff">"MSFT"</span>, <span style="color: #0000ff">"AAPL"</span>, <span style="color: #0000ff">"YHOO"</span>, <span style="color: #0000ff">"BSX"</span>, <span style="color: #0000ff">"PORT"</span>,<span style="color: #0000ff">"F"</span>, <span style="color: #0000ff">"TNT"</span>, <span style="color: #0000ff">"ESP"</span>, <span style="color: #0000ff">"RET"</span>, <span style="color: #0000ff">"VBN"</span>, <span style="color: #0000ff">"EES"</span><span style="color: #009900">}</span><span style="color: #339933">;</span>
    <span style="font-weight: bold; color: #000000">public</span> BlazeDsService<span style="color: #009900">(</span><span style="color: #009900">)</span><span style="color: #009900">{</span><span style="color: #009900">}</span>
    <span style="font-weight: bold; color: #000000">public</span> List<span style="color: #339933">&lt;</span>StockQuote<span style="color: #339933">&gt;</span> getQuotes<span style="color: #009900">(</span><span style="color: #009900">)</span><span style="color: #009900">{</span>
        List<span style="color: #339933">&lt;</span>StockQuote<span style="color: #339933">&gt;</span> list <span style="color: #339933">=</span> <span style="font-weight: bold; color: #000000">new</span> ArrayList<span style="color: #339933">&lt;</span>StockQuote<span style="color: #339933">&gt;</span><span style="color: #009900">(</span><span style="color: #009900">)</span><span style="color: #339933">;</span>
        <span style="color: #003399">Random</span> r <span style="color: #339933">=</span> <span style="font-weight: bold; color: #000000">new</span> <span style="color: #003399">Random</span><span style="color: #009900">(</span><span style="color: #009900">)</span><span style="color: #339933">;</span>
        <span style="font-weight: bold; color: #000000">for</span> <span style="color: #009900">(</span><span style="color: #003399">String</span> s<span style="color: #339933">:</span>MASTER_LIST<span style="color: #009900">)</span><span style="color: #009900">{</span>
            StockQuote sq <span style="color: #339933">=</span> <span style="font-weight: bold; color: #000000">new</span> StockQuote<span style="color: #009900">(</span><span style="color: #009900">)</span><span style="color: #339933">;</span>
            sq.<span style="color: #006633">setName</span><span style="color: #009900">(</span>s<span style="color: #009900">)</span><span style="color: #339933">;</span>
            sq.<span style="color: #006633">setPrice</span><span style="color: #009900">(</span>r.<span style="color: #006633">nextInt</span><span style="color: #009900">(</span><span style="color: #cc66cc">50</span><span style="color: #009900">)</span><span style="color: #009900">)</span><span style="color: #339933">;</span>
            list.<span style="color: #006633">add</span><span style="color: #009900">(</span>sq<span style="color: #009900">)</span><span style="color: #339933">;</span>
        <span style="color: #009900">}</span>
        <span style="font-weight: bold; color: #000000">return</span> list<span style="color: #339933">;</span>
    <span style="color: #009900">}</span>
<span style="color: #009900">}</span></pre></td></tr></tbody></table></div>
<p>Yep. Thats it. It not implementing anything crazy, not extending any service adapters, anything like that. It&#8217;s just a java class with some functions on it. Next we are going to create the object that we will be sending back and forth. In this example, we are going to be simulating retrieving some stock data, so I called the class StockQuote.</p>
<div class="wp_syntax">
<table>
<tbody>
<tr>
<td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td>
<td class="code"><pre class="java" style="font-family: monospace"><span style="font-weight: bold; color: #000000">package</span> <span style="color: #006699">com.codeofdoom</span><span style="color: #339933">;</span>
&nbsp;
<span style="font-weight: bold; color: #000000">public</span> <span style="font-weight: bold; color: #000000">class</span> StockQuote <span style="color: #009900">{</span>
    <span style="font-weight: bold; color: #000000">private</span> <span style="color: #003399">String</span> name<span style="color: #339933">;</span>
    <span style="font-weight: bold; color: #000000">private</span> <span style="font-weight: bold; color: #000066">int</span> price<span style="color: #339933">;</span>
    <span style="font-weight: bold; color: #000000">public</span> <span style="color: #003399">String</span> getName<span style="color: #009900">(</span><span style="color: #009900">)</span> <span style="color: #009900">{</span>
        <span style="font-weight: bold; color: #000000">return</span> name<span style="color: #339933">;</span>
    <span style="color: #009900">}</span>
    <span style="font-weight: bold; color: #000000">public</span> <span style="font-weight: bold; color: #000066">void</span> setName<span style="color: #009900">(</span><span style="color: #003399">String</span> name<span style="color: #009900">)</span> <span style="color: #009900">{</span>
        <span style="font-weight: bold; color: #000000">this</span>.<span style="color: #006633">name</span> <span style="color: #339933">=</span> name<span style="color: #339933">;</span>
    <span style="color: #009900">}</span>
    <span style="font-weight: bold; color: #000000">public</span> <span style="font-weight: bold; color: #000066">int</span> getPrice<span style="color: #009900">(</span><span style="color: #009900">)</span> <span style="color: #009900">{</span>
        <span style="font-weight: bold; color: #000000">return</span> price<span style="color: #339933">;</span>
    <span style="color: #009900">}</span>
    <span style="font-weight: bold; color: #000000">public</span> <span style="font-weight: bold; color: #000066">void</span> setPrice<span style="color: #009900">(</span><span style="font-weight: bold; color: #000066">int</span> price<span style="color: #009900">)</span> <span style="color: #009900">{</span>
        <span style="font-weight: bold; color: #000000">this</span>.<span style="color: #006633">price</span> <span style="color: #339933">=</span> price<span style="color: #339933">;</span>
    <span style="color: #009900">}</span>
<span style="color: #009900">}</span></pre></td></tr></tbody></table></div>
<p>On the front end, we are going to need the matching object, and here that is.</p>
<div class="wp_syntax">
<table>
<tbody>
<tr>
<td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td>
<td class="code"><pre class="actionscript3" style="font-family: monospace"><span style="font-weight: bold; color: #9900cc">package</span> com.codeofdoom.dto
<span style="color: #000000">{</span>
    <span style="color: #000000">[</span>Bindable<span style="color: #000000">]</span>
    <span style="color: #000000">[</span>RemoteClass<span style="color: #000000">(</span>alias=<span style="color: #990000">"com.codeofdoom.StockQuote"</span><span style="color: #000000">)</span><span style="color: #000000">]</span>
    <span style="font-weight: bold; color: #0033ff">public</span> <span style="font-weight: bold; color: #9900cc">class</span> StockQuote<span style="color: #000000">{</span>
        <span style="font-weight: bold; color: #0033ff">private</span> <span style="font-weight: bold; color: #6699cc">var</span> _name<span style="font-weight: bold; color: #000000">:</span><span style="color: #004993">String</span>
        <span style="font-weight: bold; color: #0033ff">private</span> <span style="font-weight: bold; color: #6699cc">var</span> _price<span style="font-weight: bold; color: #000000">:</span><span style="color: #004993">int</span>;
&nbsp;
        <span style="font-weight: bold; color: #0033ff">public</span> <span style="font-weight: bold; color: #339966">function</span> <span style="font-weight: bold; color: #0033ff">get</span> <span style="color: #004993">name</span><span style="color: #000000">(</span><span style="color: #000000">)</span><span style="font-weight: bold; color: #000000">:</span><span style="color: #004993">String</span><span style="color: #000000">{</span>
            <span style="font-weight: bold; color: #0033ff">return</span> _name;
        <span style="color: #000000">}</span>
        <span style="font-weight: bold; color: #0033ff">public</span> <span style="font-weight: bold; color: #339966">function</span> <span style="font-weight: bold; color: #0033ff">get</span> price<span style="color: #000000">(</span><span style="color: #000000">)</span><span style="font-weight: bold; color: #000000">:</span><span style="color: #004993">int</span><span style="color: #000000">{</span>
            <span style="font-weight: bold; color: #0033ff">return</span> _price;
        <span style="color: #000000">}</span>
        <span style="font-weight: bold; color: #0033ff">public</span> <span style="font-weight: bold; color: #339966">function</span> <span style="font-weight: bold; color: #0033ff">get</span> <span style="color: #004993">name</span><span style="color: #000000">(</span><span style="color: #004993">name</span><span style="font-weight: bold; color: #000000">:</span><span style="color: #004993">String</span><span style="color: #000000">)</span><span style="font-weight: bold; color: #000000">:</span><span style="font-weight: bold; color: #0033ff">void</span><span style="color: #000000">{</span>
            _name = <span style="color: #004993">name</span>;
        <span style="color: #000000">}</span>
        <span style="font-weight: bold; color: #0033ff">public</span> <span style="font-weight: bold; color: #339966">function</span> <span style="font-weight: bold; color: #0033ff">get</span> price<span style="color: #000000">(</span>price<span style="font-weight: bold; color: #000000">:</span><span style="color: #004993">int</span><span style="color: #000000">)</span><span style="font-weight: bold; color: #000000">:</span><span style="font-weight: bold; color: #0033ff">void</span><span style="color: #000000">{</span>
            _price = price;
        <span style="color: #000000">}</span>
    <span style="color: #000000">}</span>
<span style="color: #000000">}</span></pre></td></tr></tbody></table></div>
<p>I mentioned this in the last article, but I am going to mention this again, just to stress the importance. When we are using Remote Object, we must make sure that</p>
<ul><li>All the properties are the same.</li><li>We have getters and setters for all properties on back the java side and the AS side.</li><li>We must have our AS object set as Bindable and the RemoteClass set to the path of our remote object.</li><li>We must make sure that the constructors match. I have seen where flex will swallow the error message if they don&#8217;t match, making debugging a pain. </li></ul>
<p>Now lets take a look at the mxml.</p>
<div class="wp_syntax">
<table>
<tbody>
<tr>
<td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
</pre></td>
<td class="code"><pre class="mxml" style="font-family: monospace"><span style="color: #000000">&lt;?xml version=<span style="color: #ff0000">"1.0"</span> encoding=<span style="color: #ff0000">"utf-8"</span>?<span style="color: #7400ff">&gt;</span></span>
<span style="color: #000000"><span style="color: #7400ff">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000">"http://www.adobe.com/2006/mxml"</span> layout=<span style="color: #ff0000">"absolute"</span><span style="color: #7400ff">&gt;</span></span>
    <span style="color: #339933">&lt;mx:Script&gt;</span>
<span style="color: #339933">        &lt;![CDATA[</span>
<span style="color: #339933">            import mx.rpc.events.ResultEvent;</span>
<span style="color: #339933">            import mx.collections.ArrayCollection;</span>
<span style="color: #339933">            import mx.messaging.messages.IMessage;</span>
<span style="color: #339933">            import mx.messaging.events.MessageAckEvent;</span>
<span style="color: #339933">            import mx.messaging.messages.AsyncMessage;</span>
<span style="color: #339933">            import mx.messaging.events.MessageEvent;</span>
&nbsp;
<span style="color: #339933">            public function retrieveStocks():void{</span>
<span style="color: #339933">                ro.getQuotes();</span>
<span style="color: #339933">            }</span>
<span style="color: #339933">            private function result(e:ResultEvent):void{</span>
<span style="color: #339933">                stockChart.dataProvider = e.result as ArrayCollection;</span>
<span style="color: #339933">            }</span>
<span style="color: #339933">        ]]&gt;</span>
<span style="color: #339933">    &lt;/mx:Script&gt;</span>
    <span style="color: #000000"><span style="color: #7400ff">&lt;mx:RemoteObject</span> id=<span style="color: #ff0000">"ro"</span> result=<span style="color: #ff0000">"result(event)"</span> destination=<span style="color: #ff0000">"BlazeDsService"</span><span style="color: #7400ff">/&gt;</span></span>
    <span style="color: #000000"><span style="color: #7400ff">&lt;mx:VBox</span> width=<span style="color: #ff0000">"100%"</span><span style="color: #7400ff">&gt;</span></span>
        <span style="color: #000000"><span style="color: #7400ff">&lt;mx:BarChart</span> width=<span style="color: #ff0000">"100%"</span> id=<span style="color: #ff0000">"stockChart"</span><span style="color: #7400ff">&gt;</span></span>
            <span style="color: #000000"><span style="color: #7400ff">&lt;mx:horizontalAxis</span><span style="color: #7400ff">&gt;</span></span>
                <span style="color: #000000"><span style="color: #7400ff">&lt;mx:CategoryAxis</span> categoryField=<span style="color: #ff0000">"name"</span><span style="color: #7400ff">/&gt;</span></span>
            <span style="color: #000000"><span style="color: #7400ff">&lt;/mx:horizontalAxis</span><span style="color: #7400ff">&gt;</span></span>
            <span style="color: #000000"><span style="color: #7400ff">&lt;mx:series</span><span style="color: #7400ff">&gt;</span></span>
                <span style="color: #000000"><span style="color: #7400ff">&lt;mx:ColumnSeries</span> xField=<span style="color: #ff0000">"name"</span> yField=<span style="color: #ff0000">"price"</span><span style="color: #7400ff">/&gt;</span></span>
            <span style="color: #000000"><span style="color: #7400ff">&lt;/mx:series</span><span style="color: #7400ff">&gt;</span></span>
        <span style="color: #000000"><span style="color: #7400ff">&lt;/mx:BarChart</span><span style="color: #7400ff">&gt;</span></span>
        <span style="color: #000000"><span style="color: #7400ff">&lt;mx:Button</span> label=<span style="color: #ff0000">"Retrieve Stocks"</span> click=<span style="color: #ff0000">"retrieveStocks()"</span><span style="color: #7400ff">/&gt;</span></span>
    <span style="color: #000000"><span style="color: #7400ff">&lt;/mx:VBox</span><span style="color: #7400ff">&gt;</span></span>   
<span style="color: #000000"><span style="color: #7400ff">&lt;/mx:Application</span><span style="color: #7400ff">&gt;</span></span></pre></td></tr></tbody></table></div>
<p>Once again, not much to it. There are three areas of importance.</p>
<ul><li>Our remote object is that is subscribed to our destination that we declared within our remoting-config.xml.</li><li>The retrieveQuotes function is what calls our backend. Note that it just calls &#8216;getQuotes&#8217; directly from the remote object.</li><li>The result function that is set on the RemoteObject is what comes back from the back end. Now a lot of examples will do something to the grid such as dataprovider = {ro.getQuotes.lastResult}. We could do the same here, but i wanted to give you a chance to inspect the object to see what exactly is coming back. </li></ul>
<p>Once you click the Retrieve Stocks button, it then calls the getQuotes() function on the remote object. That then builds our List of objects and passes them to the front end. When it comes back, we then just apply it to the dataprovider of our chart.</p>
<p>I really wanted to take the time out to show you some other ways of handling your data within BlazeDS. It is an extremely powerful tool that every Flex developer should have under their belt. Its a lot less cumbersome than standard calls to the back end and the amount of data that is sent back and forth is a lot smaller than sending plane XML over the wire. Good luck!</p>
<p>Here is the <a href="http://codeofdoom.com/wordpress/SourceCode/BlazeDSRemoteObjects.zip">source</a></p><img src ="http://www.blogjava.net/jjshcc/aggbug/353551.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-07-02 16:59 <a href="http://www.blogjava.net/jjshcc/archive/2011/07/02/353551.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>BlazeDS Usage -Message</title><link>http://www.blogjava.net/jjshcc/archive/2011/06/29/353365.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Wed, 29 Jun 2011 07:40:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/06/29/353365.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/353365.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/06/29/353365.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/353365.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/353365.html</trackback:ping><description><![CDATA[<p>Messages</p>
<p>All communication between Flex client components and BlazeDS is performed with messages. Flex components use several message types to communicate with their corresponding services in BlazeDS. <strong>All messages have client-side (ActionScript) implementations and server-side (Java) implementations because the messages are serialized and deserialized on both the client and the server.</strong> You can also create messages directly in Java and have those messages delivered to clients using the server push API.</p>
<p><strong>Some message types, such as AcknowledgeMessage and CommandMessage, are used across different Flex components and BlazeDS services. Other message types are used by specific Flex components and BlazeDSservices.</strong> Forexample, to have a Producer component send a message to subscribed Consumer components, you create a message of type AsyncMessage and pass it to the send() method of the Producer component.</p>
<p>In other situations, you do not write code for constructing and sending messages. For example, you simply use a RemoteObject component to call the remote method from the Flex application. The RemoteObject component creates a RemotingMessage to encapsulate the RemoteObject call. In response it receives an AcknowledgeMessage from the server. The AcknowledgeMessage is encapsulated in a ResultEvent in the Flex application.</p>
<p>Sometimes you must create a message to send to the server. For example, you could send a message by creating an AsyncMessage and passing it to a Producer.<br /><br /><strong>Services and destinations<br /></strong>Services and destinations are the next links in the message processing chain in the BlazeDS server. The system includes four services and their corresponding destinationsBlazeDS:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>RemotingService and RemotingDestination<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HTPProxyService and HTTPProxyDestination<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MessageService and MessageDestination<br /></strong>Services are the targets of messages from client-side Flex components. Think of destinations as instances of a service configured in a certain way. For example, a RemoteObject component is used on the Flex client to communicate with<br />the RemotingService. In the RemoteObject component, you must specify a destination id property that refers to a remoting destination with certain properties, such as the class you want to invoke methods on. The mapping<br />between client-side Flex components and BlazeDS services is as follows:<br />&nbsp;&nbsp;&nbsp;&nbsp;<strong>&nbsp;HTTPService and WebService communicate with HTTPProxyService/HTTPProxyDestination<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RemoteObject communicates with RemotingService/RemotingDestination<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Producer and Consumer communicate with MessageService/MessageDestination<br /></strong>You can <strong>configure services and their destinations in the services-config.xml</strong> file, but it is best practice to put them in separate files as follows:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>RemotingService configured in the remoting-config.xml file<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HTTPProxyService configured in the proxy-config.xml file<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MessageService configured in the messaging-config.xml file <br /><br />The following table describes the typical setup of the configuration files. Commented versions of these files are available in the resources/config directory of the BlazeDS installation.<br /><br />
<table style="width: 1054px; height: 374px" cellspacing="2" cellpadding="2" width="1013" border="0">
<tbody>
<tr>
<td style="width: 183px; height: 35px">Filename</td>
<td>Description</td></tr>
<tr>
<td>services-config.xml</td>
<td>&nbsp;The top-level BlazeDS configuration file. This file usually contains security constraint definitions,channel definitions, and logging settings that each of the services can use. It can contain service definitions inline or include them by reference. Generally, the services are defined in the remoting-config.xml, proxy-config.xml, and messaging-config.xml.</td></tr>
<tr>
<td>remoting-config.xml</td>
<td>The Remoting Service configuration file, which defines Remoting Service destinations for working with remote objects.</td></tr>
<tr>
<td>proxy-config.xml</td>
<td>The Proxy Service configuration file, which defines Proxy Service destinations for working with web services and HTTP services (REST services).</td></tr>
<tr>
<td>messaging-config.xml</td>
<td>The Messaging Service configuration file, which defines Messaging Service destinations for performing publish subscribe messaging.</td></tr></tbody></table><br />The file-path value is relative to the location of the services-config.xml file. The following example shows service definitions included by reference:<br />&lt;services&gt;<br />&lt;!-- REMOTING SERVICE --&gt;<br />&lt;service-include file-path="remoting-config.xml"/&gt;<br />&lt;!-- PROXY SERVICE --&gt;<br />&lt;service-include file-path="proxy-config.xml"/&gt;<br />&lt;!-- MESSAGE SERVICE --&gt;<br />&lt;service-include file-path="messaging-config.xml"/&gt;<br />&lt;/services&gt;<br /></strong></p><img src ="http://www.blogjava.net/jjshcc/aggbug/353365.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-06-29 15:40 <a href="http://www.blogjava.net/jjshcc/archive/2011/06/29/353365.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>BlazeDS Uage---Building your client-side application</title><link>http://www.blogjava.net/jjshcc/archive/2011/06/29/353344.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Wed, 29 Jun 2011 04:24:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/06/29/353344.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/353344.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/06/29/353344.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/353344.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/353344.html</trackback:ping><description><![CDATA[Note: When you compile an application using mxmlc, <strong>by default the compiler references the flex-config.xml configuration file, which specifies to include the libs/player directory in the library path for Flash Player. </strong>When you compile an application for AIR, use the load-config option to the mxmlc compiler to specify the air-config.xml file, which specifies to include the libs/air directory in the library path.<br /><br /><strong>Specifying the services-config.xml file in a compilation<br /></strong>When you compile your Flex application, you typically specify the services-config.xml configuration file to the compiler. This file defines the channel URLs that the client-side Flex application uses to communicate with the BlazeDS server. Then the channel URLs are compiled into the resultant SWF file.<br />Both client-side and server-side code use the services-config.xml configuration file. If you change anything in services-config.xml, you usually have to recompile your client-side applications and restart your server-side application for the changes to take effect.<br />In Flex Builder, the appropriate services-config.xml file is included automatically based on the BlazeDS web application that you specified in the configuration of your Flex Builder project. When you use the mxmlc compiler, use the services option to specify the location of the file.<br />Note: You can also create channel definitions at run time in ActionScript. In that case, you might be able to omit the reference to the services-config.xml configuration file from the compiler.<img src ="http://www.blogjava.net/jjshcc/aggbug/353344.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-06-29 12:24 <a href="http://www.blogjava.net/jjshcc/archive/2011/06/29/353344.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>BlazeDS Uage---Messaging Service example</title><link>http://www.blogjava.net/jjshcc/archive/2011/06/29/353343.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Wed, 29 Jun 2011 03:58:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/06/29/353343.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/353343.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/06/29/353343.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/353343.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/353343.html</trackback:ping><description><![CDATA[The Messaging Service lets client applications send and receive messages from other clients. In this example, create a Flex application that sends and receives messages from the same BlazeDS destination.<br /><strong>Define the messaging destination in WEB-INF/flex/messaging-config.xml, as the following example shows</strong>: 
<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000ff">&lt;</span><span style="color: #800000">destination&nbsp;</span><span style="color: #ff0000">id</span><span style="color: #0000ff">="MessagingDestination"</span><span style="color: #ff0000">&nbsp;channels</span><span style="color: #0000ff">="my-amf-poll"</span><span style="color: #0000ff">/&gt;</span><span style="color: #000000"><br /></span></div><br /><strong>Define the my-amf-poll channel in WEB-INF/flex/services-config.xml, as the following example shows: 
<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000ff">&lt;</span><span style="color: #800000">channel-definition&nbsp;</span><span style="color: #ff0000">id</span><span style="color: #0000ff">="my-amf-poll"</span><span style="color: #ff0000">&nbsp;class</span><span style="color: #0000ff">="mx.messaging.channels.AMFChannel"</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">endpoint&nbsp;</span><span style="color: #ff0000">url</span><span style="color: #0000ff">="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpoll"</span><span style="color: #ff0000">&nbsp;class</span><span style="color: #0000ff">="flex.messaging.endpoints.AMFEndpoint"</span><span style="color: #0000ff">/&gt;</span><span style="color: #000000"><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">properties</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">polling-enabled</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">true</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">polling-enabled</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">polling-interval-seconds</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">1</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">polling-interval-seconds</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">properties</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">channel-definition</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /></span></div><br /></strong>This channel definition creates a polling channel with a polling interval of 1 second. Therefore, the client sends a poll message to the server every second to request new messages. Use a polling channel because it is the easiest way for the client to receive updates. Other options include polling with piggybacking, long-polling, and streaming.The following <strong>Flex client application uses the Producer component to send a message</strong> to the destination, and the <strong>Consumer component to receive messages sent to the destination</strong>. To send the message, the Producer first creates an instance of the AsyncMessage class and then sets its body property to the message. Then, it calls the Producer.send() method to send it. To receive messages, the Consumer first calls the Consumer.subscribe() method to subscribe to messages sent to a specific destination.<br />
<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000ff">&lt;?</span><span style="color: #ff00ff">xml&nbsp;version="1.0"</span><span style="color: #0000ff">?&gt;</span><span style="color: #000000"><br /></span><span style="color: #008000">&lt;!--</span><span style="color: #008000">&nbsp;intro\intro_messaging.mxml&nbsp;</span><span style="color: #008000">--&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">mx:Application&nbsp;</span><span style="color: #ff0000">xmlns:mx</span><span style="color: #0000ff">="http://www.adobe.com/2006/mxml"</span><span style="color: #ff0000"><br />width</span><span style="color: #0000ff">="100%"</span><span style="color: #ff0000">&nbsp;height</span><span style="color: #0000ff">="100%"</span><span style="color: #ff0000"><br />creationComplete</span><span style="color: #0000ff">="consumer.subscribe();"</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">mx:Script</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;![CDATA[</span><span style="color: #808080"><br />import&nbsp;mx.messaging.events.MessageFaultEvent;<br />import&nbsp;mx.messaging.events.MessageEvent;<br />import&nbsp;mx.messaging.messages.AsyncMessage;<br />import&nbsp;mx.messaging.Producer;<br />import&nbsp;mx.messaging.Consumer;<br />//&nbsp;Send&nbsp;the&nbsp;message&nbsp;in&nbsp;response&nbsp;to&nbsp;a&nbsp;Button&nbsp;click.<br />private&nbsp;function&nbsp;sendMessage():void&nbsp;{<br />var&nbsp;msg:AsyncMessage&nbsp;=&nbsp;new&nbsp;AsyncMessage();<br />msg.body&nbsp;=&nbsp;"Foo";<br />producer.send(msg);<br />}<br />//&nbsp;Handle&nbsp;the&nbsp;received&nbsp;message.<br />private&nbsp;function&nbsp;messageHandler(event:MessageEvent):void&nbsp;{<br />ta.text&nbsp;+=&nbsp;"Consumer&nbsp;received&nbsp;message:&nbsp;"+&nbsp;event.message.body&nbsp;+&nbsp;"\n";<br />}<br />//&nbsp;Handle&nbsp;a&nbsp;message&nbsp;fault.<br />private&nbsp;function&nbsp;faultHandler(event:MessageFaultEvent):void&nbsp;{<br />ta.text&nbsp;+=&nbsp;"Received&nbsp;fault:&nbsp;"&nbsp;+&nbsp;event.faultString&nbsp;+&nbsp;"\n";<br />}<br /></span><span style="color: #0000ff">]]&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">mx:Script</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">mx:Producer&nbsp;</span><span style="color: #ff0000">id</span><span style="color: #0000ff">="producer"</span><span style="color: #ff0000">&nbsp;destination</span><span style="color: #0000ff">="MessagingDestination"</span><span style="color: #ff0000">&nbsp;fault</span><span style="color: #0000ff">="faultHandler(event);"</span><span style="color: #0000ff">/&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">mx:Consumer&nbsp;</span><span style="color: #ff0000">id</span><span style="color: #0000ff">="consumer"</span><span style="color: #ff0000">&nbsp;destination</span><span style="color: #0000ff">="MessagingDestination"</span><span style="color: #ff0000">&nbsp;fault</span><span style="color: #0000ff">="faultHandler(event);"</span><span style="color: #ff0000">&nbsp;message</span><span style="color: #0000ff">="messageHandler(event);"</span><span style="color: #0000ff">/&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">mx:Button&nbsp;</span><span style="color: #ff0000">label</span><span style="color: #0000ff">="Send"</span><span style="color: #ff0000">&nbsp;click</span><span style="color: #0000ff">="sendMessage();"</span><span style="color: #0000ff">/&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">mx:TextArea&nbsp;</span><span style="color: #ff0000">id</span><span style="color: #0000ff">="ta"</span><span style="color: #ff0000">&nbsp;width</span><span style="color: #0000ff">="100%"</span><span style="color: #ff0000">&nbsp;height</span><span style="color: #0000ff">="100%"</span><span style="color: #0000ff">/&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">mx:Application</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /></span></div>Compile the client application into a SWF file by using Flex Builder or the mxmlc compiler, and then deploy it to<br />your web application.<br /><img src ="http://www.blogjava.net/jjshcc/aggbug/353343.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-06-29 11:58 <a href="http://www.blogjava.net/jjshcc/archive/2011/06/29/353343.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>BlazeDS Uage---RPC service example</title><link>http://www.blogjava.net/jjshcc/archive/2011/06/29/353335.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Wed, 29 Jun 2011 03:09:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/06/29/353335.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/353335.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/06/29/353335.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/353335.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/353335.html</trackback:ping><description><![CDATA[<p align="left">Configure an existing J2EE web application to support BlazeDS by performing the following steps:<br />1 Add the BlazeDS JAR files and dependent JAR files to the WEB-INF/lib directory.<br />2 Edit the BlazeDS configuration files in the WEB-INF/flex directory.<br />3 Define MessageBrokerServlet and a session listener in WEB-INF/web.xml. <br /><br />RPC service example<br />The Remoting Service is one of the RPC services included with BlazeDS. The Remoting Service lets clients access methods of Plain Old Java Objects (POJOs) on the server.In this example, you deploy a Java class, EchoService.java, on the server that echoes back a String passed to it from the client. The following code shows the definition of EchoService.java:</p>
<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080">1</span>&nbsp;<span style="color: #0000ff">package</span><span style="color: #000000">&nbsp;remoting;<br /></span><span style="color: #008080">2</span>&nbsp;<span style="color: #000000"></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">class</span><span style="color: #000000">&nbsp;EchoService<br /></span><span style="color: #008080">3</span>&nbsp;<span style="color: #000000">{<br /></span><span style="color: #008080">4</span>&nbsp;<span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;String&nbsp;echo(String&nbsp;text)&nbsp;{<br /></span><span style="color: #008080">5</span>&nbsp;<span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">"</span><span style="color: #000000">Server&nbsp;says:&nbsp;I&nbsp;received&nbsp;'</span><span style="color: #000000">"</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">+</span><span style="color: #000000">&nbsp;text&nbsp;</span><span style="color: #000000">+</span><span style="color: #000000">&nbsp;</span><span style="color: #000000">"</span><span style="color: #000000">'&nbsp;from&nbsp;you</span><span style="color: #000000">"</span><span style="color: #000000">;<br /></span><span style="color: #008080">6</span>&nbsp;<span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;}<br /></span><span style="color: #008080">7</span>&nbsp;<span style="color: #000000">}<br /></span><span style="color: #008080">8</span>&nbsp;<span style="color: #000000"></span></div>
<p align="left"><br />The echo() method takes a String argument and returns it with additional text. <strong>After compiling EchoService.java,place EchoService.class in the WEB-INF/classes/remoting</strong> directory. Notice that the Java class does not have to import or reference any BlazeDS resources.<br />Define a destination, and reference one or more channels that transport the data. <strong>Configure EchoService.class as a remoting destination by editing the WEB-INF/flex/remoting-config.xml file and adding the following code:</strong></p>
<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000ff">&lt;</span><span style="color: #800000">destination&nbsp;</span><span style="color: #ff0000">id</span><span style="color: #0000ff">="echoServiceDestination"</span><span style="color: #ff0000">&nbsp;channels</span><span style="color: #0000ff">="my-amf"</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br />&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">properties</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br />&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">source</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">remoting.EchoService</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">source</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br />&nbsp;</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">properties</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">destination</span><span style="color: #0000ff">&gt;</span></div>
<p align="left"><strong>The source element references the Java class, and the channels attribute references a channel called my-amf.Define the my-amf channel in WEB-INF/flex/services-config.xml, as the following example shows:</p>
<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000ff">&lt;</span><span style="color: #800000">channel-definition&nbsp;</span><span style="color: #ff0000">id</span><span style="color: #0000ff">="my-amf"</span><span style="color: #ff0000">&nbsp;class</span><span style="color: #0000ff">="mx.messaging.channels.AMFChannel"</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">endpoint&nbsp;</span><span style="color: #ff0000">url</span><span style="color: #0000ff">="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"</span><span style="color: #ff0000">&nbsp;class</span><span style="color: #0000ff">="flex.messaging.endpoints.AMFEndpoint"</span><span style="color: #0000ff">/&gt;</span><span style="color: #000000"><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">properties</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;</span><span style="color: #800000">polling-enabled</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">false</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">polling-enabled</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">properties</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">channel-definition</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /></span></div>
<p align="left"></strong>The channel definition specifies that the Flex client uses a non-polling AMFChannel to communicate with the AMFEndpoint on the server.<br />Note: If you deploy this application on the samples web application installed with BlazeDS, services-config.xml already contains a definition for the my-amf channel.The Flex client application uses the RemoteObject component to access EchoService. The RemoteObject component uses the destination property to specify the destination. The user clicks the Button control to invoke the remote<br />echo() method:</p>
<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000ff">&lt;?</span><span style="color: #ff00ff">xml&nbsp;version="1.0"</span><span style="color: #0000ff">?&gt;</span><span style="color: #000000"><br /></span><span style="color: #008000">&lt;!--</span><span style="color: #008000">&nbsp;intro\intro_remoting.mxml&nbsp;</span><span style="color: #008000">--&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">mx:Application&nbsp;</span><span style="color: #ff0000">xmlns:mx</span><span style="color: #0000ff">="http://www.adobe.com/2006/mxml"</span><span style="color: #ff0000">&nbsp;width</span><span style="color: #0000ff">="100%"</span><span style="color: #ff0000">&nbsp;height</span><span style="color: #0000ff">="100%"</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">mx:Script</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;![CDATA[</span><span style="color: #808080"><br />&nbsp;import&nbsp;mx.rpc.events.FaultEvent;<br />&nbsp;import&nbsp;mx.rpc.events.ResultEvent;<br />&nbsp;//&nbsp;Send&nbsp;the&nbsp;message&nbsp;in&nbsp;response&nbsp;to&nbsp;a&nbsp;Button&nbsp;click.<br />&nbsp;private&nbsp;function&nbsp;echo():void&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;var&nbsp;text:String&nbsp;=&nbsp;ti.text;<br />&nbsp;&nbsp;&nbsp;&nbsp;remoteObject.echo(text);<br />&nbsp;}<br />&nbsp;//&nbsp;Handle&nbsp;the&nbsp;recevied&nbsp;message.<br />&nbsp;private&nbsp;function&nbsp;resultHandler(event:ResultEvent):void&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ta.text&nbsp;+=&nbsp;"Server&nbsp;responded:&nbsp;"+&nbsp;event.result&nbsp;+&nbsp;"\n";<br />&nbsp;}<br />&nbsp;//&nbsp;Handle&nbsp;a&nbsp;message&nbsp;fault.<br />&nbsp;private&nbsp;function&nbsp;faultHandler(event:FaultEvent):void&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ta.text&nbsp;+=&nbsp;"Received&nbsp;fault:&nbsp;"&nbsp;+&nbsp;event.fault&nbsp;+&nbsp;"\n";<br />&nbsp;}<br />&nbsp;</span><span style="color: #0000ff">]]&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">mx:Script</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">mx:RemoteObject&nbsp;</span><span style="color: #ff0000">id</span><span style="color: #0000ff">="remoteObject"</span><span style="color: #ff0000">&nbsp;destination</span><span style="color: #0000ff">="echoServiceDestination"</span><span style="color: #ff0000">&nbsp;result</span><span style="color: #0000ff">="resultHandler(event);"</span><span style="color: #ff0000">&nbsp;fault</span><span style="color: #0000ff">="faultHandler(event);"</span><span style="color: #0000ff">/&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">mx:Label&nbsp;</span><span style="color: #ff0000">text</span><span style="color: #0000ff">="Enter&nbsp;a&nbsp;text&nbsp;for&nbsp;the&nbsp;server&nbsp;to&nbsp;echo"</span><span style="color: #0000ff">/&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">mx:TextInput&nbsp;</span><span style="color: #ff0000">id</span><span style="color: #0000ff">="ti"</span><span style="color: #ff0000">&nbsp;text</span><span style="color: #0000ff">="Hello&nbsp;World!"</span><span style="color: #0000ff">/&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">mx:Button&nbsp;</span><span style="color: #ff0000">label</span><span style="color: #0000ff">="Send"</span><span style="color: #ff0000">&nbsp;click</span><span style="color: #0000ff">="echo();"</span><span style="color: #0000ff">/&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">mx:TextArea&nbsp;</span><span style="color: #ff0000">id</span><span style="color: #0000ff">="ta"</span><span style="color: #ff0000">&nbsp;width</span><span style="color: #0000ff">="100%"</span><span style="color: #ff0000">&nbsp;height</span><span style="color: #0000ff">="100%"</span><span style="color: #0000ff">/&gt;</span><span style="color: #000000"><br /></span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">mx:Application</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br /></span></div>
<p align="left">Compile the client application into a SWF file by using Flex Builder or the mxmlc compiler, and then deploy it to<br />your web application.<br />&nbsp; </p> <img src ="http://www.blogjava.net/jjshcc/aggbug/353335.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-06-29 11:09 <a href="http://www.blogjava.net/jjshcc/archive/2011/06/29/353335.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Flash、Flex资源收集之十全大补 </title><link>http://www.blogjava.net/jjshcc/archive/2011/06/29/353321.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Wed, 29 Jun 2011 01:27:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/06/29/353321.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/353321.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/06/29/353321.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/353321.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/353321.html</trackback:ping><description><![CDATA[<p>APIs、Libs、Components</p>
<p>1、as3ebaylib</p>
<p><a href="http://code.google.com/p/as3ebaylib/">http://code.google.com/p/as3ebaylib/</a></p>
<p>2、as3youtubelib</p>
<p><a href="http://code.google.com/p/as3youtubelib/">http://code.google.com/p/as3youtubelib/</a></p>
<p>3、as3flickrlib</p>
<p><a href="http://code.google.com/p/as3flickrlib/">http://code.google.com/p/as3flickrlib/</a></p>
<p>4、Yahoo ASTRA Flash Components</p>
<p><a href="http://developer.yahoo.com/flash/astra-flash/">http://developer.yahoo.com/flash/astra-flash/</a></p>
<p>5、facebook-as3</p>
<p><a href="http://code.google.com/p/facebook-as3/">http://code.google.com/p/facebook-as3/</a></p>
<p>6、as3awss3lib</p>
<p><a href="http://code.google.com/p/as3awss3lib/">http://code.google.com/p/as3awss3lib/</a></p>
<p>7、Adobe ActionScript 3:resources:apis:libraries （官方，包括corelib、FlexUnit、Flickr、Mappr、RSS and Atom libraries、Odeo、YouTube）</p>
<p><a href="http://labs.adobe.com/wiki/index.php/ActionScript_3:resources:apis:libraries">http://labs.adobe.com/wiki/index.php/ActionScript_3:resources:apis:libraries</a></p>
<p>8、Tweener&nbsp;&nbsp;&nbsp; 用于过渡与切换的一组动画库</p>
<p><a href="http://code.google.com/p/tweener/">http://code.google.com/p/tweener/</a></p>
<p>9、uicomponents-as3&nbsp;&nbsp;&nbsp;&nbsp; 一组轻量级的AS3 UI组件库</p>
<p><a href="http://code.google.com/p/uicomponents-as3/">http://code.google.com/p/uicomponents-as3/</a></p>
<p>10、as3ds&nbsp;&nbsp;&nbsp;&nbsp; AS3的数据结构实现</p>
<p><a href="http://code.google.com/p/as3ds/">http://code.google.com/p/as3ds/</a></p>
<p>&nbsp;</p>
<p>11、mecheye-as3-libraries&nbsp;&nbsp;&nbsp;&nbsp; 一组主要用于Flash 游戏开发的AS3库</p>
<p><a href="http://code.google.com/p/mecheye-as3-libraries/">http://code.google.com/p/mecheye-as3-libraries/</a></p>
<p>12、XIFF&nbsp;&nbsp;&nbsp; 一套XMPP协议的AS3实现</p>
<p><a href="http://svn.igniterealtime.org/svn/repos/xiff/branches/xiff_as3_flexlib_beta1/">http://svn.igniterealtime.org/svn/repos/xiff/branches/xiff_as3_flexlib_beta1/</a></p>
<p>13、FZip&nbsp;&nbsp;&nbsp; 一套AS3库，可用作对ZIP压缩文件的载入、修改与创建</p>
<p><a href="http://codeazur.com.br/lab/fzip/">http://codeazur.com.br/lab/fzip/</a></p>
<p>14、FlexLib&nbsp;&nbsp;&nbsp; 一套开源的Flex界面组件库</p>
<p><a href="http://code.google.com/p/flexlib/">http://code.google.com/p/flexlib/</a></p>
<p>15、AnimatedGIfLoader Flex Component&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 可载入GIF的Flex组件</p>
<p><a href="http://dougmccune.com/blog/animatedgifloader-flex-component/">http://dougmccune.com/blog/animatedgifloader-flex-component/</a></p>
<p>16、goplayground&nbsp;&nbsp;&nbsp;&nbsp; 一套轻量级的，可用创建属于你自己的AS3 动画工具的库</p>
<p><a href="http://code.google.com/p/goplayground/">http://code.google.com/p/goplayground/</a></p>
<p>17、AlivePDF&nbsp;&nbsp;&nbsp; 开源的用于PDF创建的AS3库</p>
<p><a href="http://www.alivepdf.org/">http://www.alivepdf.org/</a></p>
<p>18、jwopitz-lib&nbsp;&nbsp;&nbsp; 一组开源的Flex用户界面组件</p>
<p><a href="http://code.google.com/p/jwopitz-lib/">http://code.google.com/p/jwopitz-lib/</a></p>
<p>19、as3crypto&nbsp;&nbsp;&nbsp; AS3实现的一套加密库，包括多种加密算法</p>
<p><a href="http://code.google.com/p/as3crypto/">http://code.google.com/p/as3crypto/</a></p>
<p>20、flare&nbsp;&nbsp;&nbsp;&nbsp; 一套强大的可视化交互的AS3类库</p>
<p><a href="http://flare.prefuse.org/">http://flare.prefuse.org/</a></p>
<p>21、SWFAddress&nbsp;&nbsp;&nbsp;&nbsp; 一小而强大的库，可以为Flash和Ajax提供深链接的功能</p>
<p><a href="http://www.asual.com/swfaddress/">http://www.asual.com/swfaddress/</a></p>
<p>22、SWFObject&nbsp;&nbsp;&nbsp;&nbsp; 用于嵌入Flash，Adobe官方也认可了</p>
<p><a href="http://code.google.com/p/swfobject/">http://code.google.com/p/swfobject/</a></p>
<p>23、ulse Particle System 一套开源的强大的AS3动态粒子系统</p>
<p><a href="http://code.google.com/p/pulse-particle/">http://code.google.com/p/pulse-particle/</a></p>
<p><a href="http://www.rogue-development.com/pulseParticles.html">http://www.rogue-development.com/pulseParticles.html</a></p>
<p>24、SpringGraph Flex Component</p>
<p><a href="http://mark-shepherd.com/blog/springgraph-flex-component/">http://mark-shepherd.com/blog/springgraph-flex-component/</a></p>
<p>25、GoASAP&nbsp;&nbsp;&nbsp;&nbsp; AS3动画库</p>
<p><a href="http://code.google.com/p/goasap/">http://code.google.com/p/goasap/</a></p>
<p><a href="http://www.goasap.org/index.html">http://www.goasap.org/index.html</a></p>
<p>26、asaplibrary&nbsp;&nbsp;&nbsp; 一套开源的Flash Actionscript3.0 RIA库</p>
<p><a href="http://code.google.com/p/asaplibrary/">http://code.google.com/p/asaplibrary/</a></p>
<p><a href="http://asaplibrary.org/">http://asaplibrary.org/</a></p>
<p><a href="http://asapframework.org">http://asapframework.org</a></p>
<p>27、as3mathlib 开源Flex/Actionscript数学库</p>
<p><a href="http://code.google.com/p/as3mathlib/">http://code.google.com/p/as3mathlib/</a></p>
<p>28、as3corelib 包含一些基础功能AS3库</p>
<p><a href="http://code.google.com/p/as3corelib/">http://code.google.com/p/as3corelib/</a></p>
<p>29、minimalcomps 一组AS3 UI组件</p>
<p><a href="http://www.bit-101.com/minimalcomps/">http://www.bit-101.com/minimalcomps/</a></p>
<p>30、as3gif</p>
<p><a href="http://code.google.com/p/as3gif/">http://code.google.com/p/as3gif/</a></p>
<p>31、queueloader-as3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一组AS3库，用来进行资源序列载入及监测</p>
<p><a href="http://code.google.com/p/queueloader-as3/">http://code.google.com/p/queueloader-as3/</a></p>
<p>32、TweenMax (AS3)</p>
<p><a href="http://blog.greensock.com/tweenmaxas3/">http://blog.greensock.com/tweenmaxas3/</a></p>
<p>33、Atellis Reflection Component&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一款Flex反射效果组件</p>
<p><a href="http://labs.atellis.com/2007/07/11/atellis-reflection-component/">http://labs.atellis.com/2007/07/11/atellis-reflection-component/</a></p>
<p>34、AS3Eval&nbsp;&nbsp;&nbsp;&nbsp; 简单来说，就是用AS3实现的AS3编译器</p>
<p><a href="http://eval.hurlant.com/">http://eval.hurlant.com/</a></p>
<p>35、ByteArray 的组件、库合集，包括liquid components、mousegesture、ASZip、GIF Player、GIF Animation Encoder、AlivePDF、Live JPEG Encoder、ScaleBitmap等</p>
<p><a href="http://www.bytearray.org/?page_id=82">http://www.bytearray.org/?page_id=82</a></p>
<p>36、AS3C&nbsp;&nbsp;&nbsp;&nbsp; 针对AVM2虚拟机，用C#写的字节码编译器</p>
<p><a href="http://code.google.com/p/as3c/">http://code.google.com/p/as3c/</a></p>
<p>37、as3httpclientlib&nbsp;&nbsp;&nbsp; as3实现的http客户端</p>
<p><a href="http://code.google.com/p/as3httpclientlib/">http://code.google.com/p/as3httpclientlib/</a></p>
<p>38、as3ui&nbsp;&nbsp; 一组常规的as3 ui界面库</p>
<p><a href="http://code.google.com/p/as3ui/">http://code.google.com/p/as3ui/</a></p>
<p>39、as3xls 让你在flex中可以读写Excel文件</p>
<p><a href="http://code.google.com/p/as3xls/">http://code.google.com/p/as3xls/</a></p>
<p>40、as3flexdb 让你的flex程序可以连接到MySQL服务器，主要是使用AMFPHP来访问PHP服务器</p>
<p><a href="http://code.google.com/p/as3flexdb/">http://code.google.com/p/as3flexdb/</a></p>
<p>这一是一篇详细使用介绍的教程</p>
<p><a href="http://itutorials.ro/viewtopic.php?f=9&amp;t=7">http://itutorials.ro/viewtopic.php?f=9&amp;t=7</a></p>
<p>41、vivisectingmedia-as3 一组AS3/Flex实用库，是作者在实践中总结出来的</p>
<p><a href="http://code.google.com/p/vivisectingmedia-as3/">http://code.google.com/p/vivisectingmedia-as3/</a></p>
<p>42、assql&nbsp;&nbsp; 通过ActionScript 3.0 直接连接MySQL 数据库</p>
<p><a href="http://code.google.com/p/assql/">http://code.google.com/p/assql/</a></p>
<p>43、FlexserverLib&nbsp;&nbsp; Flex &amp; BlazeDS服务端扩展</p>
<p><a href="http://code.google.com/p/flexserverlib/">http://code.google.com/p/flexserverlib/</a></p>
<p><a href="http://www.infoaccelerator.net/blog/post.cfm/announcing-flexserverlib-the-blazeds-extension-project">http://www.infoaccelerator.net/blog/post.cfm/announcing-flexserverlib-the-blazeds-extension-project</a></p>
<p>44、dphibernate Flex/BlazeDS Hibernate Adapter ，支持延迟加载</p>
<p><a href="http://code.google.com/p/dphibernate/">http://code.google.com/p/dphibernate/</a></p>
<p>45、as3syntaxhighlight&nbsp;&nbsp; as3及mxml代码高亮库</p>
<p><a href="http://code.google.com/p/as3syntaxhighlight/">http://code.google.com/p/as3syntaxhighlight/</a></p>
<p>46、Tweensy&nbsp;&nbsp; 一款新的缓动及运动效果库</p>
<p><a href="http://code.google.com/p/tweensy/">http://code.google.com/p/tweensy/</a></p>
<p>47、JSwoof the fastest JSON parser for Flex</p>
<p><a href="http://www.waynemike.co.uk/jswoof">http://www.waynemike.co.uk/jswoof</a></p>
<p>48、casa lib&nbsp;&nbsp; it provides a core set of classes,interfaces,and utilities</p>
<p><a href="http://casalib.org/">http://casalib.org/</a></p>
<p>49、FlipCard&nbsp;&nbsp;&nbsp; 3D Flip Card for Flex</p>
<p><a href="http://code.google.com/p/flipcard/">http://code.google.com/p/flipcard/</a></p>
<p>50、Efflex 一组特效库</p>
<p><a href="http://code.google.com/p/efflex/">http://code.google.com/p/efflex/</a></p>
<p><a href="http://www.efflex.org/">http://www.efflex.org/</a></p>
<p>51、ObjectHandles&nbsp;&nbsp; 一组能用UI组件，允许你对组件进行绽放与移动</p>
<p><a href="http://www.rogue-development.com/objectHandles.html">http://www.rogue-development.com/objectHandles.html</a></p>
<p><a href="http://code.google.com/p/flex-object-handles/wiki/ObjectHandlesUsage">http://code.google.com/p/flex-object-handles/wiki/ObjectHandlesUsage</a></p>
<p>52、as3commons 一组as3通用库</p>
<p><a href="http://code.google.com/p/as3-commons/">http://code.google.com/p/as3-commons/</a></p>
<p><a href="http://www.as3commons.org/">http://www.as3commons.org/</a></p>
<p>53、urlkit 为Flex应用程序提供URL deep linking深度链接的库</p>
<p><a href="http://code.google.com/p/urlkit/">http://code.google.com/p/urlkit/</a></p>
<p>54、standingwave 音频合成的Flash/Flex库</p>
<p><a href="http://code.google.com/p/standingwave/">http://code.google.com/p/standingwave/</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Actionscript 3.0 Class</p>
<p>1、fZip&nbsp;&nbsp;&nbsp; 此类可允许你载入标准的zip文件并提取里面包含的文件</p>
<p><a href="http://wahlers.com.br/claus/blog/zip-it-up/">http://wahlers.com.br/claus/blog/zip-it-up/</a></p>
<p>2、AS3: Layout class for Flash CS3&nbsp;&nbsp;&nbsp;&nbsp; 一组用作布局的类</p>
<p><a href="http://www.senocular.com/?id=2.8">http://www.senocular.com/?id=2.8</a></p>
<p>3、CSSLoader&nbsp;&nbsp;&nbsp;&nbsp; 该类允许Flex应用程序在运行时载入CSS</p>
<p><a href="http://www.rubenswieringa.com/blog/cssloader">http://www.rubenswieringa.com/blog/cssloader</a></p>
<p>4、AS3: QueryString&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一个单例类，用来获取URL地址后所带参数值对</p>
<p><a href="http://evolve.reintroducing.com/2008/07/03/as3/as3-querystring/#more-141">http://evolve.reintroducing.com/2008/07/03/as3/as3-querystring/#more-141</a></p>
<p>5、ActionScript 3 Contextual Menu Manager Class&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AS3关联菜单管理类</p>
<p><a href="http://www.blog.noponies.com/archives/103">http://www.blog.noponies.com/archives/103</a></p>
<p>6、Spark project 一系列丰富的AS3库，小日本开发</p>
<p><a href="http://www.libspark.org/wiki/WikiStart/en">http://www.libspark.org/wiki/WikiStart/en</a></p>
<p>2D &amp; 3D Engine</p>
<p>1、APE (Actionscript Physics Engine)&nbsp; 物理引擎</p>
<p><a href="http://www.cove.org/ape/">http://www.cove.org/ape/</a></p>
<p>2、Away3D</p>
<p><a href="http://code.google.com/p/away3d/">http://code.google.com/p/away3d/</a></p>
<p>3、Papervision3D</p>
<p><a href="http://code.google.com/p/papervision3d/">http://code.google.com/p/papervision3d/</a></p>
<p>4、Sandy&nbsp;&nbsp;&nbsp;&nbsp; 开源3D库</p>
<p><a href="http://www.flashsandy.org/versions/3.0">http://www.flashsandy.org/versions/3.0</a></p>
<p>5、FORM&nbsp;&nbsp; 一套AS3完成的用于2D刚性物体的物理引擎</p>
<p><a href="http://code.google.com/p/foam-as3/">http://code.google.com/p/foam-as3/</a></p>
<p>6、Five3D&nbsp;&nbsp;&nbsp; 基于矢量的Flash 3D 交互动画创建</p>
<p><a href="http://five3d.mathieu-badimon.com/">http://five3d.mathieu-badimon.com/</a></p>
<p>7、Flade (Flash Dynamics Engine)&nbsp;&nbsp; 一套开源的2D物理引擎，AS2实现</p>
<p><a href="http://www.cove.org/flade/">http://www.cove.org/flade/</a></p>
<p>8、Box2DFlashAS3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2D物理引擎，AS3实现，基于强大的Box2D C++物理库</p>
<p><a href="http://box2dflash.sourceforge.net/">http://box2dflash.sourceforge.net/</a></p>
<p><a href="http://sourceforge.net/projects/box2dflash/">http://sourceforge.net/projects/box2dflash/</a></p>
<p>9、Paradox&nbsp;&nbsp;&nbsp; 基于Flash的第一称3D引擎</p>
<p><a href="http://animasinteractive.com/propaganda/">http://animasinteractive.com/propaganda/</a></p>
<p>10、ND3D AS3 3D Engine 一款简单的AS3开源3D引擎，编译后的引擎大小仅约10K</p>
<p><a href="http://code.google.com/p/nd3d/">http://code.google.com/p/nd3d/</a></p>
<p><a href="http://www.nulldesign.de/nd3d-as3-3d-engine/">http://www.nulldesign.de/nd3d-as3-3d-engine/</a></p>
<p>11、Pulse Particles&nbsp;&nbsp; 能用的AS3粒子创建系统</p>
<p><a href="http://www.rogue-development.com/pulseParticles.html">http://www.rogue-development.com/pulseParticles.html</a></p>
<p><a href="http://code.google.com/p/pulse-particle/">http://code.google.com/p/pulse-particle/</a></p>
<p>12、jiglibflash Flash 3D物理引擎</p>
<p><a href="http://code.google.com/p/jiglibflash/">http://code.google.com/p/jiglibflash/</a></p>
<p><a href="http://www.jiglibflash.com/blog/">http://www.jiglibflash.com/blog/</a></p>
<p>13、motor2 同样是基于Box2D，ActionScript3.0实现的一款2D引擎</p>
<p><a href="http://code.google.com/p/motor2/">http://code.google.com/p/motor2/</a></p>
<p><a href="http://lab.polygonal.de/motor_physics/">http://lab.polygonal.de/motor_physics/</a></p>
<p>14、WOW-Engine as3实现的物理引擎，源于Sandy</p>
<p><a href="http://seraf.mediabox.fr/wow-engine/as3-3d-physics-engine-wow-engine/">http://seraf.mediabox.fr/wow-engine/as3-3d-physics-engine-wow-engine/</a></p>
<p>FrameWorks</p>
<p>1、Cairngorm&nbsp;&nbsp;&nbsp; Adobe官方出的Flex框架</p>
<p><a href="http://labs.adobe.com/wiki/index.php/Cairngorm">http://labs.adobe.com/wiki/index.php/Cairngorm</a></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; flexcairngorm:Extensions for the Adobe Cairngorm MVC</p>
<p><a href="http://code.google.com/p/flexcairngorm/">http://code.google.com/p/flexcairngorm/</a></p>
<p>2、PureMVC&nbsp;&nbsp;&nbsp; 纯AS3框架，也有其它语言的实现</p>
<p><a href="http://www.puremvc.org/">http://www.puremvc.org/</a></p>
<p>3、ASWing AS3&nbsp;&nbsp; 一套开源的AS3 GUI框架</p>
<p><a href="http://www.aswing.org/">http://www.aswing.org/</a></p>
<p>4、EasyMVC&nbsp;&nbsp; 由事件驱动的MVC框架</p>
<p><a href="http://projects.simb.net/easyMVC/">http://projects.simb.net/easyMVC/</a></p>
<p>5、Mate 基于Tag及事件驱动的Flex框架</p>
<p><a href="http://mate.asfusion.com/">http://mate.asfusion.com/</a></p>
<p>6、ARP&nbsp;&nbsp;&nbsp;&nbsp; 基于模式（Pattern）的RIA框架，Flash平台，支持AS2和AS3</p>
<p><a href="http://osflash.org/projects/arp">http://osflash.org/projects/arp</a></p>
<p>7、Gaia&nbsp;&nbsp; 开源的Flash前端框架，支持AS2和AS3，用于快速开发</p>
<p><a href="http://www.gaiaflashframework.com/">http://www.gaiaflashframework.com/</a></p>
<p>8、flest&nbsp;&nbsp; Actionscript3.0/Flex应用程序框架，用来开发企业级的RIA</p>
<p><a href="http://code.google.com/p/flest/">http://code.google.com/p/flest/</a></p>
<p>9、Gugga&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Flash Framework&nbsp;&nbsp;&nbsp; 更新至AS3</p>
<p><a href="http://www.gugga.com/flashblog/">http://www.gugga.com/flashblog/</a></p>
<p>10、Spring ActionScript(以前名为Prana） 另一个提供了IOC反转控制的框架，类似著名的Spring框架</p>
<p><a href="http://www.pranaframework.org/">http://www.pranaframework.org/</a></p>
<p><a href="http://www.herrodius.com/blog/projects">http://www.herrodius.com/blog/projects</a></p>
<p>11、OpenFlux&nbsp;&nbsp;&nbsp; 开源的Flex组件框架，让开发Flex组件更加快速容易</p>
<p><a href="http://code.google.com/p/openflux/">http://code.google.com/p/openflux/</a></p>
<p>12、Degrafa&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 声明式的Flex图形框架，允许以MXML标签的方式绘制图形、创建皮肤，还包括对CSS的支持</p>
<p><a href="http://code.google.com/p/degrafa/">http://code.google.com/p/degrafa/</a></p>
<p>13、FlexMVCs&nbsp;&nbsp;&nbsp; 针对AS3和Flex的应用程序框架，基于PureMVC，作了些修正和精简</p>
<p><a href="http://code.google.com/p/flexmvcs/">http://code.google.com/p/flexmvcs/</a></p>
<p>14、Ruboss&nbsp;&nbsp; 结合Flex与ROR的快速开发的框架</p>
<p><a href="http://ruboss.com/">http://ruboss.com/</a></p>
<p>15、dpHibernate&nbsp;&nbsp; Flex3/BlazeDS Hibernate适配器，支持延迟加载</p>
<p><a href="http://code.google.com/p/dphibernate/">http://code.google.com/p/dphibernate/</a></p>
<p>16、dpUnit 一套新的Flex测试框架</p>
<p><a href="http://code.google.com/p/dpuint/">http://code.google.com/p/dpuint/</a></p>
<p>17、flight framework 一套新的MVC框架，可应用于Flash及Flex当中</p>
<p><a href="http://code.google.com/p/flight-framework/">http://code.google.com/p/flight-framework/</a></p>
<p><a href="http://www.flightxd.com/flightframework/">http://www.flightxd.com/flightframework/</a></p>
<p>18、Moccasin 一款可用于图形编辑应用程序的Flex框架</p>
<p><a href="http://joeberkovitz.com/blog/2008/09/30/moccasin-intro/">http://joeberkovitz.com/blog/2008/09/30/moccasin-intro/</a></p>
<p>19、RestfulX&nbsp;&nbsp; 一款将Rails的设计理念带入Flex与AIR的框架，the RESTful way to develop Adobe Flex and AIR applications</p>
<p><a href="http://restfulx.github.com/">http://restfulx.github.com/</a></p>
<p>20、smartypants-ico Dependency Injection framework for Flex 提供了IOC控制反转性的Flex框架</p>
<p><a href="http://code.google.com/p/smartypants-ioc/">http://code.google.com/p/smartypants-ioc/</a></p>
<p><a href="http://flex.joshmcdonald.info/">http://flex.joshmcdonald.info/</a></p>
<p>21、glue&nbsp;&nbsp;&nbsp; Beautiful Gooey MVC Framework for Flex</p>
<p><a href="http://wiki.github.com/seanhess/glue/">http://wiki.github.com/seanhess/glue/</a></p>
<p>22、coordy 一款轻量级的ActionScript3 布局框架</p>
<p><a href="http://code.google.com/p/coordy/">http://code.google.com/p/coordy/</a></p>
<p><a href="http://somerandomdude.com/articles/technology/coordy/">http://somerandomdude.com/articles/technology/coordy/</a></p>
<p>23、Parsley 另一款AS3 ioc框架，强烈推荐 &#9733;&#9733;&#9733;</p>
<p><a href="http://www.spicefactory.org/">http://www.spicefactory.org/</a></p>
<p><a href="http://coenraets.org/blog/2009/07/building-a-flex-application-with-the-parsley-framework/">http://coenraets.org/blog/2009/07/building-a-flex-application-with-the-parsley-framework/</a></p>
<p>24、Flex IOC 框架</p>
<p><a href="http://code.google.com/p/legato/">http://code.google.com/p/legato/</a></p>
<p>25、另一款Flex IOC 框架</p>
<p><a href="http://sourceforge.net/projects/flicc/">http://sourceforge.net/projects/flicc/</a></p>
<p>26、一款轻量级的纯AS3的，部分思想来源于PureMVC</p>
<p><a href="http://www.robotlegs.org/">http://www.robotlegs.org/</a></p>
<p><a href="http://github.com/robotlegs/robotlegs-demos-Bundle">http://github.com/robotlegs/robotlegs-demos-Bundle</a></p>
<p>Flash &amp; Flex Tools、Servers</p>
<p>1、FlexUnit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Flex/Actionscript3.0单元测试框架</p>
<p><a href="http://code.google.com/p/as3flexunitlib/">http://code.google.com/p/as3flexunitlib/</a></p>
<p>2、Visual FlexUnit 增强的FlexUnit，支持&#8220;可视化断言&#8221;</p>
<p><a href="http://code.google.com/p/visualflexunit/">http://code.google.com/p/visualflexunit/</a></p>
<p>3、RED bug&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; debug调试控制器，让Flash、Flex、AIR应用程序更加容易</p>
<p><a href="http://www.realeyesmedia.com/redbug/">http://www.realeyesmedia.com/redbug/</a></p>
<p>4、reflexutil 可在运行时对Flex组件进行调试</p>
<p><a href="http://code.google.com/p/reflexutil/">http://code.google.com/p/reflexutil/</a></p>
<p>5、FxSpy&nbsp;&nbsp;&nbsp; 当Flex应用程序运行时可以检测和动态的改变可视化组件属性值<a href="http://code.google.com/p/fxspy/">http://code.google.com/p/fxspy/</a></p>
<p>6、ThunderBolt 基于Firefox的Firebug插件的日志扩展，支持AS2及AS3</p>
<p><a href="http://code.google.com/p/flash-thunderbolt/">http://code.google.com/p/flash-thunderbolt/</a></p>
<p>7、FlashTracer Firefox扩展，可以以侧栏的方式将Flash中trace()的结果显示</p>
<p>8、RIALogger 另一款Flex/AIR的Debug工具</p>
<p><a href="http://renaun.com/blog/flex-components/rialogger/">http://renaun.com/blog/flex-components/rialogger/</a></p>
<p>9、Alcon 一款轻量级的AS2及AS3的Debug工具，AIR方式将Debug信息展示出来</p>
<p><a href="http://blog.hexagonstar.com/alcon/">http://blog.hexagonstar.com/alcon/</a></p>
<p>10、GDS (Granite Data Services) 开源，提供了Adobe LiveCycle Data Services类似功能的服务器</p>
<p><a href="http://www.graniteds.org/">http://www.graniteds.org/</a></p>
<p>11、FlexMonkey 针对Flex的单元测试框架，为Flex应用程序，提供了Flex UI功能的自动测试</p>
<p><a href="http://code.google.com/p/flexmonkey/">http://code.google.com/p/flexmonkey/</a></p>
<p>12、FlexCover 代码覆盖率检测</p>
<p><a href="http://code.google.com/p/flexcover/">http://code.google.com/p/flexcover/</a></p>
<p>13、Fluint 单元测试与集成测试框架，改进了些FlexUnit功能</p>
<p><a href="http://code.google.com/p/fluint/">http://code.google.com/p/fluint/</a></p>
<p>14、SWFScan Flash security tools</p>
<p><a href="https://h30406.www3.hp.com/campaigns/2009/wwcampaign/1-5TUVE/index.php?key=swf&amp;jumpid=go/swfscan">https://h30406.www3.hp.com/campaigns/2009/wwcampaign/1-5TUVE/index.php?key=swf&amp;jumpid=go/swfscan</a></p>
<p>15、De MonsterDebugger Open source debugger for Adobe Flash,Flex and AIR</p>
<p><a href="http://demonsterdebugger.com/">http://demonsterdebugger.com/</a></p>
<p>16、Antennae 使用Ant建立复杂Flex项目的模板</p>
<p><a href="http://code.google.com/p/antennae/">http://code.google.com/p/antennae/</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Flex Explorers&nbsp; （大部分为Flex2版本，但同样适用于Flex3）</p>
<p>1、Flex3 Component Explorer&nbsp;&nbsp;&nbsp; Flex各类组件示例</p>
<p><a href="http://examples.adobe.com/flex3/componentexplorer/explorer.html">http://examples.adobe.com/flex3/componentexplorer/explorer.html</a></p>
<p>2、Resize ManagerFX Explorer （此为商业作品，要收费的）</p>
<p><a href="http://www.teotigraphix.com/explorers/ResizeManagerFX/ResizeManagerFXExplorer.html">http://www.teotigraphix.com/explorers/ResizeManagerFX/ResizeManagerFXExplorer.html</a></p>
<p>3、Flex3 Style Explorer</p>
<p><a href="http://examples.adobe.com/flex3/consulting/styleexplorer/Flex3StyleExplorer.html">http://examples.adobe.com/flex3/consulting/styleexplorer/Flex3StyleExplorer.html</a></p>
<p>4、Flex2 Style Explorer （添加了Kuler功能）Flex UI组件风格定制并可输出为CSS</p>
<p><a href="http://www.maclema.com/content/sek/">http://www.maclema.com/content/sek/</a></p>
<p>5、Flex2 Style Explorer （Adobe 原始的版本）</p>
<p><a href="http://examples.adobe.com/flex2/consulting/styleexplorer/Flex2StyleExplorer.html">http://examples.adobe.com/flex2/consulting/styleexplorer/Flex2StyleExplorer.html</a></p>
<p>6、Flex2 Filter Explorer&nbsp;&nbsp;&nbsp; 查看各类滤镜效果并可进行设置</p>
<p><a href="http://merhl.com/flex2_samples/filterExplorer/">http://merhl.com/flex2_samples/filterExplorer/</a></p>
<p><a href="http://merhl.com/?p=40">http://merhl.com/?p=40</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (AIR版本)</p>
<p>7、Flex2 Primitive Explorer&nbsp;&nbsp;&nbsp; 在Flex中创建各种简单形状</p>
<p><a href="http://www.flexibleexperiments.com/Flex/PrimitiveExplorer/Flex2PrimitiveExplorer.html">http://www.flexibleexperiments.com/Flex/PrimitiveExplorer/Flex2PrimitiveExplorer.html</a></p>
<p>8、Custom Easing Function Explore V1.0.0&nbsp;&nbsp;&nbsp; 自定义创建缓动效果函数</p>
<p><a href="http://www.madeinflex.com/img/entries/2007/05/customeasingexplorer.html">http://www.madeinflex.com/img/entries/2007/05/customeasingexplorer.html</a></p>
<p>9、Tour De Flex&nbsp;&nbsp; 组件资源集合，包括Flex核心组件，第三方组件等，必备</p>
<p><a href="http://flex.org/tour">http://flex.org/tour</a></p>
<p>10、Regular Expression Explorer&nbsp;&nbsp;&nbsp; 正则表达式浏览器</p>
<p><a href="http://ryanswanson.com/regexp/">http://ryanswanson.com/regexp/</a></p>
<p>11、AS3 Performance Tester</p>
<p><a href="http://businessintelligence.me/projects/performance_tester/performanceTester.html">http://businessintelligence.me/projects/performance_tester/performanceTester.html</a></p>
<p>转载的话请注明出处：<a href="http://www.jexchen.com">http://www.jexchen.com</a><br /></p><img src ="http://www.blogjava.net/jjshcc/aggbug/353321.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-06-29 09:27 <a href="http://www.blogjava.net/jjshcc/archive/2011/06/29/353321.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Flex中XMLSocket与Java中Socket通信</title><link>http://www.blogjava.net/jjshcc/archive/2011/06/28/353298.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Tue, 28 Jun 2011 13:05:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/06/28/353298.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/353298.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/06/28/353298.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/353298.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/353298.html</trackback:ping><description><![CDATA[<p>Flex中XMLSocket与Java中Socket通信，遇到的问题是，Java中的socket能够接受到XMLSocket传输的数据，但是Flex并不能接受到从Java服务器传输的数据，从网上搜了好多资料，终于找到了原因，原来XMLSocket 接收到服务端下发的数据时，将连续放于接收缓冲区，直到接收到 "\0" 字节（字节内容为 ASCII 值 0），才认为接收完成，并调用相应的 onData 或 onXML 事件，因此，服务端若用 Java 编写，并使用标准的 String 类族，则在发送数据结尾应手动加上 "\0"，同样，当XMLSocket发送数据时，也会在数据的结尾自动加上"\0"。</p>
<p>我现在将我做的一个简单的XMLSocket通信的例子贴出来跟大家共享一下，如果有什么不足的地方，还望大家批评指出，毕竟我也是flex初学者，呵呵！</p>
<p>Java应用程序代码：<br />&nbsp;view plaincopy to clipboardprint?<br />public class XMLServerSocket {&nbsp;&nbsp; <br />&nbsp; <br />&nbsp; <br />&nbsp;&nbsp;&nbsp; private ServerSocket serverSocket;&nbsp;&nbsp; <br />&nbsp; <br />&nbsp;&nbsp;&nbsp; private Socket socketin;&nbsp;&nbsp; <br />&nbsp; <br />&nbsp;&nbsp;&nbsp; private BufferedReader br;&nbsp;&nbsp; <br />&nbsp; <br />&nbsp;&nbsp;&nbsp; private PrintStream ps;&nbsp;&nbsp; <br />&nbsp; <br />&nbsp;&nbsp;&nbsp; public static void main(String[] args) {&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new XMLServerSocket();&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br />&nbsp; <br />&nbsp;&nbsp;&nbsp; private XMLServerSocket() {&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; serverSocket = new ServerSocket(8800);&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; socketin = serverSocket.accept();&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; br = new BufferedReader(new InputStreamReader(socketin&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .getInputStream()));&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ps = new PrintStream(socketin.getOutputStream());&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ps.println("Input EXIT for end\0");&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ps.flush();&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out("Input EXIT for end");&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; boolean done = false;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (!done) {&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String str = br.readLine();&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (str == null || (str.length() == 1 &amp;&amp; str.charAt(0) == '\0')) {&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; done = true;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char first = str.charAt(0);&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char tail = str.charAt(str.length() - 1);&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (first == '\0') {&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; str = str.substring(1);&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (tail == '\0') {&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; str = str.substring(0, str.length() - 2);&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out(str);&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ps.println(str + "\0");&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (str.trim().equals("EXIT")) {&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; done = true;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; br.close();&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (Exception e) {&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(e.getMessage());&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br />&nbsp; <br />&nbsp;&nbsp;&nbsp; private void out(String str) {&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(str);&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br />&nbsp; <br />}&nbsp; <br />public class XMLServerSocket {</p>
<p><br />&nbsp;private ServerSocket serverSocket;</p>
<p>&nbsp;private Socket socketin;</p>
<p>&nbsp;private BufferedReader br;</p>
<p>&nbsp;private PrintStream ps;</p>
<p>&nbsp;public static void main(String[] args) {<br />&nbsp;&nbsp;new XMLServerSocket();<br />&nbsp;}</p>
<p>&nbsp;private XMLServerSocket() {<br />&nbsp;&nbsp;try {<br />&nbsp;&nbsp;&nbsp;serverSocket = new ServerSocket(8800);<br />&nbsp;&nbsp;&nbsp;socketin = serverSocket.accept();<br />&nbsp;&nbsp;&nbsp;br = new BufferedReader(new InputStreamReader(socketin<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.getInputStream()));<br />&nbsp;&nbsp;&nbsp;ps = new PrintStream(socketin.getOutputStream());<br />&nbsp;&nbsp;&nbsp;ps.println("Input EXIT for end\0");<br />&nbsp;&nbsp;&nbsp;ps.flush();<br />&nbsp;&nbsp;&nbsp;out("Input EXIT for end");<br />&nbsp;&nbsp;&nbsp;boolean done = false;<br />&nbsp;&nbsp;&nbsp;while (!done) {<br />&nbsp;&nbsp;&nbsp;&nbsp;String str = br.readLine();<br />&nbsp;&nbsp;&nbsp;&nbsp;if (str == null || (str.length() == 1 &amp;&amp; str.charAt(0) == '\0')) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;done = true;<br />&nbsp;&nbsp;&nbsp;&nbsp;} else {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char first = str.charAt(0);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char tail = str.charAt(str.length() - 1);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (first == '\0') {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str = str.substring(1);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (tail == '\0') {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str = str.substring(0, str.length() - 2);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out(str);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ps.println(str + "\0");<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (str.trim().equals("EXIT")) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;done = true;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;br.close();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;} catch (Exception e) {<br />&nbsp;&nbsp;&nbsp;System.out.println(e.getMessage());<br />&nbsp;&nbsp;}<br />&nbsp;}</p>
<p>&nbsp;private void out(String str) {<br />&nbsp;&nbsp;System.out.println(str);<br />&nbsp;}</p>
<p>}</p>
<p>Flex程序代码：</p>
<p>view plaincopy to clipboardprint?<br />&lt;?xml version="1.0" encoding="utf-8"?&gt;&nbsp; <br />&lt;mx:Application xmlns:mx="<a href="http://www.adobe.com/2006/mxml">http://www.adobe.com/2006/mxml</a>" layout="absolute"&gt;&nbsp; <br />&nbsp;&nbsp;&nbsp; &lt;mx:Script&gt;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!--[CDATA[&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private var xmlconnect:XMLSocket;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private function connectServer():void&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try{&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlconnect = new XMLSocket();&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlconnect.connect("localhost",8800);&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlconnect.addEventListener(DataEvent.DATA,onData);&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch(e:Error)&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; trace(e.message);&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private function onData(event:DataEvent):void&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; content.text = event.text;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private function sendData():void&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlconnect.send(datasend.text + "\n");//必须加上"\n"，否则数据不能成功发送&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ]]--&gt;&nbsp; <br />&nbsp;&nbsp;&nbsp; &lt;/mx:Script&gt;&nbsp; <br />&nbsp;&nbsp;&nbsp; &lt;mx:Text id="content" width="271" height="116" horizontalCenter="0" verticalCenter="0" /&gt;&nbsp; <br />&nbsp;&nbsp;&nbsp; &lt;mx:TextInput id="datasend" horizontalCenter="0" verticalCenter="95"/&gt;&nbsp; <br />&nbsp;&nbsp;&nbsp; &lt;mx:Button label="发送" horizontalCenter="0" verticalCenter="121" click="sendData()"/&gt;&nbsp; <br />&nbsp;&nbsp;&nbsp; &lt;mx:Button label="连接" horizontalCenter="0" verticalCenter="-103" click="connectServer()"/&gt;&nbsp; <br />&lt;/mx:Application&gt;&nbsp; </p>
<p>&nbsp;</p><img src ="http://www.blogjava.net/jjshcc/aggbug/353298.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-06-28 21:05 <a href="http://www.blogjava.net/jjshcc/archive/2011/06/28/353298.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>搭建全功能绿色版本的Flex Builder 3.0.1</title><link>http://www.blogjava.net/jjshcc/archive/2011/06/27/353102.html</link><dc:creator>Eric_jiang</dc:creator><author>Eric_jiang</author><pubDate>Mon, 27 Jun 2011 14:09:00 GMT</pubDate><guid>http://www.blogjava.net/jjshcc/archive/2011/06/27/353102.html</guid><wfw:comment>http://www.blogjava.net/jjshcc/comments/353102.html</wfw:comment><comments>http://www.blogjava.net/jjshcc/archive/2011/06/27/353102.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jjshcc/comments/commentRss/353102.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jjshcc/services/trackbacks/353102.html</trackback:ping><description><![CDATA[<p>准备工作：</p>
<p>JDK 6 安装程序 <br /><a href="http://download.actuatechina.com/eclipse/technology/epp/downloads/release/ganymede/R/eclipse-jee-ganymede-win32.zip ">Eclipse IDE for Java EE Developers <br /></a>Adobe Flex Builder 3.0.1 Professional Eclipse Plug-in <br />7-Zip Command Line Version <br /><br />开始工作：<br />创建两个目录，分别用来存储Flex Builder文件和临时文件，如D:\Flex和D:\Temp。 <br />将下载得到的四个文件放到D:\Temp内。 <br />解压缩下载到的7-Zip文件，获取到7za.exe程序，也将其放到D:\Temp内。 <br />安装JDK 6到D:\Flex\jdk1.6.0_07，中途无需安装JRE。 <br />提示：如果已经安装了JDK的话，直接将其复制过来即可。 <br />进入命令行模式，依次执行以下命令： <br />D: <br />cd \Temp <br />切换到D:\Temp目录。 <br />7za x eclipse-jee-ganymede-win32.zip -oD:\Flex <br />move D:\Flex\eclipse D:\Flex\eclipse3.4jee <br />解压eclipse并将目录名改成eclipse3.4jee。 <br />7za x FB3_WWEJ_Plugin.exe -oFB3 <br />7za x FB3\InstallerData\Disk1\InstData\Resource1.zip -oFB3 <br />从Flex Builder安装程序提取出我们所需要的文件备用。 <br />创建一个启动文件startup.bat，内容如下：<br />@echo off<br />set JAVA_HOME=%CD%\jdk1.6.0_07<br />set JRE_HOME=%JAVA_HOME%\jre <br />set CLASSPATH=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar <br />set PATH=%JRE_HOME%\bin;%JAVA_HOME%\bin;%PATH% <br />start eclipse3.4jee\eclipse.exe <br />启动eclipse，进行如下操作： <br />设置工作区：D:\Temp。 <br />Help -&gt; Software Updates...，弹出如下图所示窗口，我们点击Update...，经过一系列的Next -&gt; Finish，开始了eclipse3.4jee版本的自更新,更新完成后，点击Yes重启eclipse。&nbsp;重启完成后，再次Help -&gt; Software Update...，这次，我们使用Available Software选项卡。&nbsp;点Add Site... -&gt; Archive...后选择&#8220;D:\Temp\FB3\$BUILDSTAGE$\com.adobe.flexbuilder.update.site_ad0c1b9596a1_zg_ia_sf.jar&#8221;或直接输入&#8220;jar:file:D:\Temp\FB\$BUILDSTAGE$\com.adobe.flexbuilder.update.site_ad0c1b9596a1_zg_ia_sf.jar!/&#8221;，OK。&nbsp;<br />&nbsp;选择新加入的Flex Builder，并点击右上角的Install...，经过一系列的Next -&gt; Finish，开始了Flex Builder插件的安装。&nbsp;<br />&nbsp;再次重启，完成了Eclipse集成Flex Builder插件的操作。 <br />我们的工作还没完，继续在命令行中执行以下命令来提取Flex SDK： <br />7za x FB3\$DEFAULT_SDK$_ad0c1ba696ac_zg_ia_sf.jar -oD:\Flex\eclipse3.4jee\plugins\com.adobe.flexbuilder.flex_3.0.205647\devsdks\3.1.0 <br />7za x FB3\$NDEPOT_IDE_ROOT$\zorn.flex\devsdks\2.0.1_zg_ia_sf.jar -oD:\Flex\eclipse3.4jee\plugins\com.adobe.flexbuilder.flex_3.0.205647\devsdks\2.0.1 <br />清理掉D:\Temp，OK！大功告成！ <br />最后，我们将其压缩起来，以便日后的使用，命令行命令如下： <br />D: <br />cd \Flex <br />del eclipse3.4jee\configuration\.settings\org.eclipse.ui.ide.prefs <br />7za a FlexBuilder.zip或FlexBuilder.7z <br />把FlexBuilder.zip（537MB）或FlexBuilder.7z（377MB）保留起来吧，以后只需要简单的解压并执行其中的startup.bat就可以立即进入到Flex Builder开发环境啦！ </p>
<p>&nbsp;</p><img src ="http://www.blogjava.net/jjshcc/aggbug/353102.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jjshcc/" target="_blank">Eric_jiang</a> 2011-06-27 22:09 <a href="http://www.blogjava.net/jjshcc/archive/2011/06/27/353102.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>