<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title><![CDATA[RIA爱好者]]></title>
<link>http://www.riafan.com/</link>
<description><![CDATA[Flash Remoting Chinese Platform]]></description>
<language>zh-cn</language>
<copyright><![CDATA[CopyRight 2006-2008 RIA爱好者]]></copyright>
<webMaster><![CDATA[jimllf@163.com(Flying)]]></webMaster>
<generator>PBlog2 v2.7</generator> 
<image>
	<title>RIA爱好者</title> 
	<url>http://www.riafan.com/images/logos.gif</url> 
	<link>http://www.riafan.com/</link> 
	<description>RIA爱好者</description> 
</image>

			<item>
			<link>http://www.riafan.com/default.asp?id=134</link>
			<title><![CDATA[将属性的XML解析成对象数组列表]]></title>
			<author>jimllf@163.com(Flying)</author>
			<category><![CDATA[Flash]]></category>
			<pubDate>Fri,25 Apr 2008 23:56:49 +0800</pubDate>
			<guid>http://www.riafan.com/default.asp?id=134</guid>	
            <description><![CDATA[<p class="paragraph">源码如下：</p>
<pre class="code">
package utils {
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.net.URLLoader;		

	/**
	 * @author Flying
	 */

	public class XMLParser extends EventDispatcher {

		public var parsedData : Array;
		public static  const PARSE : String = "parse";

		/**
		 * @param loader 加载器
		 */

		public function XMLParser(loader : URLLoader) {
			loader.addEventListener(Event.COMPLETE, completeHandler);
		}

		public function completeHandler(event : Event) : void {
			var item_xmlList : XMLList = XML(URLLoader(event.target).data).children();
			var xmlObj_array : Array = new Array();
			var item_xml : XML;
			for each (item_xml in item_xmlList) {
				var tempObj : Object = new Object();
				var node : XML;
				for each (node in item_xml.attributes()) {
					//用localName方法获取XML对象的限定名称
					var obj : Object = node.localName();
					tempObj[obj] = item_xml.@[obj];
				}
				xmlObj_array.push(tempObj);
			}
			parsedData = xmlObj_array;
			dispatchEvent(new Event(XMLParser.PARSE));
		}
	}
}
</pre>
<p class="paragraph">此类基于EventDispatcher类，构造时以URLLoader对象作为参数，当XML解析完后会派发<font color="#800000">PARSE</font>事件，并将得到的对象数组列表作为事件对象的属性传递。</p>]]></description>
		</item>
		
			<item>
			<link>http://www.riafan.com/default.asp?id=133</link>
			<title><![CDATA[将Flex Datagrid导出到Excel]]></title>
			<author>jimllf@163.com(Flying)</author>
			<category><![CDATA[Flex]]></category>
			<pubDate>Sat,12 Apr 2008 23:32:33 +0800</pubDate>
			<guid>http://www.riafan.com/default.asp?id=133</guid>	
            <description><![CDATA[<p class="paragraph">思路比较简单：</p>
<p class="paragraph">1. 将DataGrid输出为对应的Html字符串，一个DataGrid对应一个&lt;table&gt;&lt;/table&gt;，DataGridColumn的headerText属性对应&lt;th&gt;&lt;/th&gt;，DataGrid的一行对应一个&lt;tr&gt;&lt;/tr&gt;，DataGrid的一个单元格对应一个&lt;td&gt;&lt;/td&gt;；另外我们还可以使用<span class="ActionScriptDefault_Text">getStyle方法将当前的样式属性值与table的样式属性值对应；</span></p>
<p class="paragraph">2.使用URLVariables 类和URLLoader类将字符串变量发送到服务器端脚本。详见：<a class="titleA" href="http://www.riafan.com/article.asp?id=131">使用URLLoader类和URLVariables类实现AS3与服务器通信</a>；</p>
<p class="paragraph">3.在服务器端我们只是简单地加一个文件头，再将Flex端发送的字符串在客户端打印出来。如果使用aps.net，请validateRequest设定为false；</p>
<p class="paragraph">说明：如果DataGrid的数据庞大，样式很多，生成的html字符串会很大，因此发送到服务器端输出Excel的效率不高。因此我们最好是只将DataGrid的过滤条件及样式发送到服务器端，然后在服务器端使用html字符串输出Excel。当然在服务器端使用Jexcel或POI API可以更好地控制Excel的输出。</p>
<p class="paragraph"><a href="http://www.riafan.com/flex/flexdgtoexcel"><font color="#1f3a87">点击此处</font></a>查看最终效果，<a href="http://www.riafan.com/flex/flexdgtoexcel/srcview/flexdgtoexcel.zip"><font color="#1f3a87">点击此处</font></a>下载源文件。</p>]]></description>
		</item>
		
			<item>
			<link>http://www.riafan.com/default.asp?id=132</link>
			<title><![CDATA[使用E4X实现AS3与服务器通信]]></title>
			<author>jimllf@163.com(Flying)</author>
			<category><![CDATA[Flash]]></category>
			<pubDate>Thu,10 Apr 2008 22:53:21 +0800</pubDate>
			<guid>http://www.riafan.com/default.asp?id=132</guid>	
            <description><![CDATA[<p class="paragraph">1.将用户输入的内容动态绑定到XML对象，然后通过URLRequest对象将该对象发送到服务器端。在E4X中，可以使用大括号运算<font color="#800000"><code>{</code> 和 <code>}</code></font>在构造XML对象时按引用(从其它变量)传递数据，也可以使用<code>insertChildBefore()</code> 方法或<code>insertChildAfter()</code>方法在指定属性之前或之后添加属性，或者直接使用 <code>=</code> 运算符将属性赋予XML 对象。注意：request的contentType属性，即<font face="Courier New">POST</font> 数据的MIME 内容类型为<font color="#800000">text/xml</font>；request的data属性，即包含将随URL 请求一起传输的数据指定为动态绑定的XML对象。</p>
<p class="paragraph">2. 在服务器端，加载发送的XML包，取得其属性值并将其作为SQL查询语句的筛选条件，最后将生成的XML文件打印出来。</p>
<p class="paragraph">3. 使用URLLoader类从URL加载XML数据，AS2中使用XML对象的是sendAndLoad或Load方法。</p>
<p class="paragraph">4. XML数据加载完毕后，接着将其解析成DataGrid可支持的Array数据源类型。在AS3中，我们可以使用点 (.) 运算符和后代存取器 (..) 运算符可以访问 XML 对象的子属性，这样解析XML就方便多了。</p>
<p class="paragraph">说明：另外我们还可以使用括号运算符过滤具有特定元素名称或属性值的元素。也就是说，可以先在服务器端生成XML文件，然后再在Flex端过滤查询记录。不过因为未过滤生成的XML文件相比之下很大，第一次请求会很慢。</p>
<p class="paragraph"><a href="http://www.riafan.com/flash/e4x"><font color="#1f3a87">点击此处</font></a>查看最终效果，<a href="http://www.riafan.com//userfiles/file/08-04/e4x.rar"><font color="#1f3a87">点击此处</font></a>下载源文件。后台脚本和数据库见<a href="http://www.riafan.com/article.asp?id=11">http://www.riafan.com/article.asp?id=11</a>中的附件。</p>]]></description>
		</item>
		
			<item>
			<link>http://www.riafan.com/default.asp?id=131</link>
			<title><![CDATA[使用URLLoader类和URLVariables类实现AS3与服务器通信]]></title>
			<author>jimllf@163.com(Flying)</author>
			<category><![CDATA[Flash]]></category>
			<pubDate>Fri,04 Apr 2008 22:15:24 +0800</pubDate>
			<guid>http://www.riafan.com/default.asp?id=131</guid>	
            <description><![CDATA[<p class="paragraph">在本例中我们创建了一个名为variables的URLVariables对象，该对象动态创建名为userName和msg的属性，并用表单的输入文本值为其其赋值。接下来，我们创建了一个URLRequest 对象，该对象指定变量要发送到的服务器端脚本的URL。然后，设置URLRequest 对象的method 属性，以便将变量作为HTTP POST请求发送。为了清除服务器脚本生成的缓存数据文件，我们添加了文件头。再下一步我们将URLRequest 对象的 data 属性设置为早先创建的variables对象，这样URLVariables对象就添加到URL 请求了。最后，我们创建 URLLoader实例并调用URLLoader.load() 方法，此方法用于启动该请求。</p>
<p class="paragraph">至于处理服务器的响应，我们是用URLLoader 类的<font face="Courier New">complete事件来处理的。</font>与早期版本ActionScript 中的 XML 和 LoadVars 类非常相似，URLLoader URL 的数据在下载完成之前不可用。</p>
<p class="paragraph">最后值得一提的是，AS3允许通过URLRequestHeader对文件头进行操作，这是一个很重要的提升。</p>
<p class="paragraph">注意：本例所需的后台脚本与使用LoadVars实现Flash与服务器通信那篇文章中用到的一样：脚本的每个名称-值对都创建为URLVariables对象中的一个属性。唯一不一样的是：<font color="#800000">第一个名称-值不能加&amp;，否则会报错：Error #2101: 传递给URLVariables.decode() 的字符串必须是包含名称/值对的 URL 编码的查询字符串。</font></p>
<p class="paragraph"><a href="http://www.riafan.com/flash/urlvariables"><font color="#1f3a87">点击此处</font></a>查看最终效果，<a href="http://www.riafan.com//userfiles/file/08-04/urlvariables.rar"><font color="#1f3a87">点击此处</font></a>下载源文件。附件包含本例所需的各种后台脚本。</p>
<p class="paragraph">资源：</p>
<p class="paragraph">1.URLVariables：<a href="http://livedocs.adobe.com/flash/9.0_cn/ActionScriptLangRefV3/flash/net/URLVariables.html">http://livedocs.adobe.com/flash/9.0_cn/ActionScriptLangRefV3/flash/net/URLVariables.html</a></p>
<p class="paragraph">2.URLLoader：<a href="http://livedocs.adobe.com/flash/9.0_cn/ActionScriptLangRefV3/flash/net/URLLoader.html">http://livedocs.adobe.com/flash/9.0_cn/ActionScriptLangRefV3/flash/net/URLLoader.html</a></p>
<p class="paragraph">&nbsp;</p>
<p class="paragraph">&nbsp;</p>]]></description>
		</item>
		
			<item>
			<link>http://www.riafan.com/default.asp?id=130</link>
			<title><![CDATA[如何获取menu当前选择项的路径]]></title>
			<author>jimllf@163.com(Flying)</author>
			<category><![CDATA[Flash]]></category>
			<pubDate>Mon,31 Mar 2008 22:28:42 +0800</pubDate>
			<guid>http://www.riafan.com/default.asp?id=130</guid>	
            <description><![CDATA[<pre class="code">&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; viewSourceURL=&quot;srcview/index.html&quot;&gt;
    &lt;mx:Script&gt;
        &lt;![CDATA[
        	import mx.controls.Menu;

            import mx.events.MenuEvent;
            
            [Bindable]
            private var paths:Array;
            
            private var menubarXML:XML =
                &lt;menuitems&gt;
                    &lt;menuitem label=&quot;File&quot;&gt;
                        &lt;menuitem label=&quot;New&quot; data=&quot;1-1&quot;/&gt;
                        &lt;menuitem label=&quot;Open&quot; data=&quot;1-2&quot;/&gt;
                    &lt;/menuitem&gt;
                    &lt;menuitem label=&quot;Search&quot;&gt;
                    &lt;menuitem label=&quot;Search...&quot; data=&quot;2-1&quot;/&gt;
                    &lt;menuitem label=&quot;File...&quot; data=&quot;2-2&quot;/&gt;
		  &lt;menuitem label=&quot;Declaration&quot;&gt;
                            &lt;menuitem label=&quot;File&quot; data=&quot;2-3-1&quot;/&gt;
	                        &lt;menuitem label=&quot;Project&quot; data=&quot;2-3-2&quot;/&gt;
	                        &lt;menuitem label=&quot;WorkSpace&quot; data=&quot;2-3-3&quot;/&gt;
  			&lt;/menuitem&gt;
                        &lt;menuitem label=&quot;References&quot;&gt;
                        	&lt;menuitem label=&quot;File&quot; data=&quot;2-4-1&quot;/&gt;
	                        &lt;menuitem label=&quot;Project&quot; data=&quot;2-4-2&quot;/&gt;
	                        &lt;menuitem label=&quot;WorkSpace&quot; data=&quot;2-4-3&quot;/&gt;
                        	&lt;/menuitem&gt;
                    &lt;/menuitem&gt;
                    &lt;menuitem type=&quot;separator&quot;/&gt;
                    &lt;menuitem label=&quot;About&quot; data=&quot;3&quot;/&gt;
                &lt;/menuitems&gt;;

            private function addMenu():void {
            	paths = new Array();
            	var menu:Menu = Menu.createMenu(null, menubarXML, false);
            	menu.labelField=&quot;@label&quot;;
                	var pt:Point = new Point(25, 65);
                	pt = panel.localToGlobal(pt);
                
                	menu.show(pt.x, pt.y);
                	menu.addEventListener(MenuEvent.ITEM_CLICK, itemClickHandler);

            }        
            private function itemClickHandler(event:MenuEvent):void{
            	findParent(event.item);
            	function findParent(xml:XML):void{
            		if(xml.parent()!=null){
            			findParent(xml.parent());
            			paths.push(xml.@label);
            		}
            	}
            	lblPath.text = paths.toString();
            }
         ]]&gt;
    &lt;/mx:Script&gt;
    
    &lt;mx:Panel id=&quot;panel&quot; title=&quot;Menu&quot;
    	 paddingTop=&quot;10&quot; paddingLeft=&quot;10&quot; height=&quot;100%&quot; width=&quot;100%&quot;&gt;
    	&lt;mx:Button id=&quot;btn&quot; label=&quot;Show Menu&quot; click=&quot;this.addMenu()&quot; /&gt;
	    &lt;mx:ApplicationControlBar&gt;
    		&lt;mx:Label id=&quot;lblPath&quot;/&gt;
	    &lt;/mx:ApplicationControlBar&gt;
    &lt;/mx:Panel&gt;
&lt;/mx:Application&gt;</pre>
<p class="paragraph">核心代码位于itemClickHandler事件侦听函数中，我们这里使用了递归算法。</p>
<p class="paragraph"><a href="http://www.riafan.com/flex/menupath">点击此处</a>查看最终效果。</p>]]></description>
		</item>
		
			<item>
			<link>http://www.riafan.com/default.asp?id=129</link>
			<title><![CDATA[BlazeDS入门——Message Service]]></title>
			<author>jimllf@163.com(Flying)</author>
			<category><![CDATA[Flex]]></category>
			<pubDate>Sun,23 Mar 2008 21:56:40 +0800</pubDate>
			<guid>http://www.riafan.com/default.asp?id=129</guid>	
            <description><![CDATA[<p class="paragraph">一、Message Service</p>
<p class="paragraph">Message Service 提供发布(publish)/订阅(subscribe)机制允许Flex 应用程序发布消息、订阅消息终端(messaging destination)，从而实现数据的实时推动和协作传送。</p>
<p class="paragraph">消息终端在messaging-config.xml配置，其中频道(channel)是其关键元素，它用来实现客户端和服务器端交换数据。使用BlazeDS，消息终端通常用作streaming频道或者polling频道。</p>
<p class="paragraph">使用streaming频道，服务器端会一直响应HTTP请求直到该频道连接被关闭，它允许服务器向客户端不断传送大量的数据。因为HTTP连接是独一无二的，这实现数据的双向传送，每个streaming AMF或者HTTP频道事实上需要两个浏览器 HTTP连接， 一个连接需要不断处理服务器端与频道紧密相关的客户端的响应。另外需要一个短暂连接,只有当数据需要传送到服务器时，它才脱离浏览器连接池；当短暂连接不再需要时，它立即被释放回浏览器连接池。</p>
<p class="paragraph">polling频道可以通过简单的时间间隔或者使用服务器等待来配置，如果数据不马上可用 (长轮循)的话。另外，每次轮循响应完成请求。默认下浏览器HTTP 1.1的连接是持续的，浏览器轮循已有的连接，发送并发的轮循请求，以此来减轻轮循的开销。</p>
<p class="paragraph"><font color="#800000">当需要准实时通信时，streaming 频道是最好选择</font>。</p>
<p class="paragraph">二、IE 与 Firefox浏览器下的不同</p>
<p class="paragraph">浏览器对每个session都有连接数限制。不同的浏览器，连接最大数以及对session的处理方式都不一样。</p>
<p class="paragraph">IE中每个session的最大连接数为2。 但如果从开始菜单或快捷方式打开多个IE实例，每个IE实例开启不同的进程并拥有各自session。另外，如果我们通过CTRL+N 开启对已有的IE实例一个新的IE窗口，该窗口将与创建它的IE实例共用一个session 。也就是说，如果程序实例开启不同的进程，我们可以通过HTTP streaming建立不限量应用取得服务器端数据；如果通过CTRL+N开启多个窗口，每个session最多建立2个连接。</p>
<p class="paragraph">Firefox中每个session最多建立8个连接。如果从开始菜单或快捷方式打开多个Firefox实例，所有实例开启使用同一进程并共用一个session。既然浏览器对普通的HTTP请求通常只需要一个连接， 理论上我们可以最多可以建立7个HTTP streaming连接。</p>
<p class="paragraph">三、messaging-config.xml</p>
<p class="paragraph">另外，如果每个session到达最大连接数，使用streaming channel连接到服务器的下一次尝试将失败：<font color="#800000">Endpoint with id 'my-streaming-amf' cannot grant streaming connection to FlexClient with id 'D640B86F-6B1D-92DF-8288-1B737A371AFE' because max-streaming-connections-per-session limit of '1' has been reached</font>。不过，BlazeDS提供一种优雅的退后机制来处理这种情况：客户端始终会尝试使用频道表(messaging-config.xml中为服务终端定义)中的第一个频道来连接。如果该连接失败, 客户端将自动退后到频道表中的下一频道。在本实例中，我们为所有的服务终端定义了如下默认的ChannelSet：</p>
<pre class="code">&lt;default-channels&gt;
    &lt;channel ref=&quot;my-streaming-amf&quot;/&gt;
    &lt;channel ref=&quot;my-polling-amf&quot;/&gt;
&lt;/default-channels&gt;</pre>
<p class="paragraph">也就是说，客户端应用会首先尝试使用streaming channel连接，如果连接失败会使用polling channel。</p>
<p class="paragraph">客户端代码和使用LCDS差不多，比较简单，基本上都会使用Producer来发布聊天内容，使用Consumer来订阅聊天内容，从而实现实时聊天。另外本应用有简单的登入登出功能。</p>]]></description>
		</item>
		
			<item>
			<link>http://www.riafan.com/default.asp?id=128</link>
			<title><![CDATA[BlazeDS入门——Remote Object Service]]></title>
			<author>jimllf@163.com(Flying)</author>
			<category><![CDATA[Flex]]></category>
			<pubDate>Sat,15 Mar 2008 23:20:12 +0800</pubDate>
			<guid>http://www.riafan.com/default.asp?id=128</guid>	
            <description><![CDATA[<p class="paragraph">1. 编写远程服务类</p>
<p class="paragraph">编写BlazeDS的Java远程服务类有三个要求：</p>
<p class="paragraph">1) 所有被调用的方法必须是public；</p>
<p class="paragraph">2) 所有的编译类必须能够通过BlazeDS的classpath访问得到；</p>
<p class="paragraph">3) 类必须是stateful/stateless的。</p>
<p class="paragraph">大家可以参考工程文件中的SimpleService.java。</p>
<p class="paragraph">2. 配置remoting-config.xml</p>
<p class="paragraph">Java服务类写好后，还需要配置，BlazeDS的Remote Service也是在服务器端对应了一个配置文件：remoting-config.xml，配置好Remote Service后，Flex在运行时才能找到相应的服务类用其调用的方法。下面就是本工程的Remote Service配置文件。</p>
<p><img alt="" border="0" src="http://www.riafan.com//userfiles/image/08-03/remoting-config.gif" /></p>
<p class="paragraph">第2~3行指定服务的ID和对应的类，第5~7行设置适配器(adapters)的ID和对应的类。第9~11行指定默认的频道(channels)及其参照，该频道是在services-config.xml中定义的。适配器和频道可以设置多个，采用第一个优先的原则。前面这几项设置适用于proxy-config.xml、remoting-config.xml和我们后面要讲的messaging-config.xml。</p>
<p class="paragraph">第13~18行设置的服务终端(destination)，该属性必须和RemoteObject组件的服务终端属性一致。按照服务的种类，服务终端又可以分为代理服务终端、远程服务终端和消息服务终端。上一次讲述的代理服务终端，需要指定该终端的url，而这次我们讲述的远程服务终端，需要指定该终端的source和scope。source对应RemoteObject要调用的远程服务的全限定类名，<font color="#800000">不像FluorineFX，它不能在RemoteObject组件中指定</font>。scope表示当前远程服务的作用范围，即远程服务类是stateful还是stateless，有application、session和request三个选项。</p>
<p class="paragraph"><font color="#800000">注意：我们提倡在配置文件中设置，这样更安全也方便后期维护。</font></p>
<p class="paragraph">3. 使用RemoteObjec组件</p>
<p class="paragraph">对于RemoteObjec组件，请参看<a href="http://www.riafan.com/article.asp?id=54">http://www.riafan.com/article.asp?id=54</a>的相关内容。一句话，Flex的RemoteObject与后台语言是无关的。在工程文件中的BasicRemoteObject.mxml，调用了SimpleService类的三个方法，当通过BlazeDS从J2EE服务器返回RemoteObjec时，Java数据被序列化成ActionScript数据。其中Java字符串对应ActionScript字符串，Java的数组列表对应ActionScript ArrayCollection。如果你想了解更多Java与ActionScript数据类型的转换，请参考<a href="http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_4.html">http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_4.html</a></p>]]></description>
		</item>
		
			<item>
			<link>http://www.riafan.com/default.asp?id=127</link>
			<title><![CDATA[BlazeDS入门——HTTP Service]]></title>
			<author>jimllf@163.com(Flying)</author>
			<category><![CDATA[Flex]]></category>
			<pubDate>Sat,08 Mar 2008 23:00:55 +0800</pubDate>
			<guid>http://www.riafan.com/default.asp?id=127</guid>	
            <description><![CDATA[<p class="paragraph">其实BlazeDS可以看成是LCDS的简化版，它少了后者的Data Management Service高级功能，目前不支持RTMP协议。</p>
<p class="paragraph">一、下载BlazeDS</p>
<p class="paragraph">BlazeDS已经推出正式版：<a href="http://opensource.adobe.com/wiki/display/blazeds/Release+Builds">http://opensource.adobe.com/wiki/display/blazeds/Release+Builds</a>，它有三个版本，其中Turnkey版内置了Tomcat和 Flex 3 SDK，还包含blazeds.war、ds-console.war和samples.war，建议初学者使用；Binary Distribution版只包括blazeds.war，此为最简配置；而Source则包含blazeds的Java源代码，想做二次开发就下载这个。</p>
<p class="paragraph">二、新建BlazeDS工程</p>
<p class="paragraph">1. 创建Flex工程，勾选<font color="#800000">Use remote object access service</font>。</p>
<p class="paragraph"><img class="" alt="" border="0" src="http://www.riafan.com//userfiles/image/08-03/project.gif" /></p>
<p class="paragraph">&nbsp;最好在WTP上安装Flex 插件版，这样可以将Flex和Java整合在一个工程中。</p>
<p class="paragraph">2.&nbsp;配置J2EE服务器，对于BlazeDS来说，使用Tomcat就可以了。设定上下文路径和blazeds.war的位置，如下图。</p>
<p class="paragraph"><img class="" alt="" border="0" src="http://www.riafan.com//userfiles/image/08-03/j2ee.gif" /></p>
<p class="paragraph">3.&nbsp; 设置资源文件夹名、主文件名称和输出文件的路径，如下图。</p>
<p class="paragraph"><img class="" alt="" border="0" src="http://www.riafan.com//userfiles/image/08-03/path.gif" /></p>
<p class="paragraph">三、同域访问</p>
<p class="paragraph">访问HTTP Service可以直接在Flex端直接指定一个同域名的URL，也可以在<font color="#800000">proxy-config.xml</font>中设置代理。现在我们就用一个简单的HTTP Service来检验工程是否可以在服务器上运行，请参考HTTPServiceDemo.mxml。</p>
<p class="paragraph">四、使用服务器端代理</p>
<p class="paragraph">更多情况下，我们需要对HTTP Service跨域访问，这就会存在Flash Player存在安全沙箱问题。对于跨域访问RPC有三种解决方案：使用Proxy Service和Remote Object Service或者在目标域下部署crossdomain.xml策略文件。</p>
<p class="paragraph">对于服务器端代理，可以简单在服务器端定义DefaultHTTP，打开<font color="#800000">proxy-config.xml</font>，如下配置。其中*号表示http://127.0.0.1:8080/blazeds下所有的HTTP Service。由于我们已经设置了默认的destination，因此在Flex端不需要设定destination了，但需要在Flex中指定HTTPService的绝对URL属性，并设定<font color="#800000">useProxy=&quot;true&quot;。</font>请参看DefaultDestination.mxml。</p>
<pre class="code">&lt;destination id=&quot;DefaultHTTP&quot;&gt;
      &lt;properties&gt;
           &lt;dynamic-url&gt;http://127.0.0.1:8080/blazeds/*&lt;/dynamic-url&gt;
      &lt;/properties&gt;
 &lt;/destination&gt;</pre>
<p class="paragraph">如上所述，服务器端代理使用默认的destination，需要指定HTTPService的绝对URL属性，不灵活不安全，我们更多时候还是要自定义destination。如下面的配置，我们在proxy-config.xml中设置destination的属性值为<font color="#800000">student</font>，然后就可以在Flex中设定destination为<font color="#800000">student</font>，然后就可以调用该端点对应的HTTP Service了。请参考NamedDestination.mxml。</p>
<pre class="code">&lt;destination id=&quot;student&quot;&gt;
      &lt;properties&gt;
          &lt;url&gt;http://{server.name}:{server.port}/{context.root}/data/student.xml&lt;/url&gt;
      &lt;/properties&gt;
 &lt;/destination&gt;</pre>
<p class="paragraph">注意：</p>
<p class="paragraph">1.使用BlazeDS/WTP整合向导时，BlazeDS工程的Content&nbsp; Root始终是/WebContent，请修改成根据Root URL作相应修改；</p>
<p class="paragraph">2. 运行主程序前请导出发布版本(Export Release Build)并启动服务器；</p>
<p class="paragraph">3.在url元素中，{server.name}之类的变量和*不能同时使用。关于BlazeDS的配置，我们在后面还会讲述。如果我们安装了Turnkey版，可以在blazeds\resources\config中查看更详细的配置。</p>
<p class="paragraph"><a href="http://www.riafan.com//userfiles/file/08-03/blazeds.zip"><font color="#1f3a87">点击此处</font></a>下载工程文件。该工程文件也包括后面要讲述的部分。</p>]]></description>
		</item>
		
			<item>
			<link>http://www.riafan.com/default.asp?id=126</link>
			<title><![CDATA[AIR新书预告]]></title>
			<author>jimllf@163.com(Flying)</author>
			<category><![CDATA[Desktop]]></category>
			<pubDate>Sat,01 Mar 2008 10:37:33 +0800</pubDate>
			<guid>http://www.riafan.com/default.asp?id=126</guid>	
            <description><![CDATA[<p class="paragraph">1. <a href="http://www.amazon.com/Breaking-Out-Web-Browser-Adobe/dp/0321503562/ref=pd_sim_b_img_4">Breaking Out of the Web Browser with Adobe AIR</a></p>
<p><img class="" alt="" border="0" src="http://ecx.images-amazon.com/images/I/41FCLuSmRBL._AA240_.jpg" /></p>
<p class="paragraph">2. <a href="http://www.amazon.com/Foundation-AIR-Creating-Applications-Integrated/dp/1590599373/ref=pd_sim_b_img_3">Foundation AIR: Creating Desktop Applications with the Adobe Integrated Runtime (Foundation)</a></p>
<p><img class="" alt="" border="0" src="http://ecx.images-amazon.com/images/I/41ZzaNz6e8L._AA240_.jpg" /></p>
<p>&nbsp;</p>]]></description>
		</item>
		
			<item>
			<link>http://www.riafan.com/default.asp?id=125</link>
			<title><![CDATA[Flex 3新书预告]]></title>
			<author>jimllf@163.com(Flying)</author>
			<category><![CDATA[Flex]]></category>
			<pubDate>Sat,01 Mar 2008 10:16:26 +0800</pubDate>
			<guid>http://www.riafan.com/default.asp?id=125</guid>	
            <description><![CDATA[<p class="paragraph">1. <a href="http://www.amazon.com/Adobe-Flex-3-Training-Source/dp/0321529189/ref=pd_sim_b_img_2/102-1221061-1398509">Adobe Flex 3: Training from the Source</a></p>
<p><a href="http://www.amazon.com/Adobe-Flex-3-Training-Source/dp/0321529189/ref=pd_sim_b_img_2/102-1221061-1398509"><img class="" alt="" border="0" src="http://ecx.images-amazon.com/images/I/41%2Bmo3GHU-L._AA240_.jpg" /></a></p>
<p class="paragraph">2. <a href="http://www.amazon.com/Essential-Guide-Flex/dp/1590599500/ref=pd_bxgy_b_img_b">The Essential Guide to Flex 3</a></p>
<p><img class="" alt="" border="0" src="http://ecx.images-amazon.com/images/I/41QtjYE2fAL._AA240_.jpg" /></p>
<p class="paragraph">3. <a href="http://www.amazon.com/Flex-Beginners-Michele-E-Davis/dp/0071544186/ref=pd_sim_b_img_1">Flex 3: A Beginner's Guide</a></p>
<p><img class="" alt="" border="0" src="http://ecx.images-amazon.com/images/I/51v4Bkr3RzL._AA240_.jpg" /></p>
<p class="paragraph">4. <a href="http://www.amazon.com/Professional-Adobe-Flex-Rich-Tretola/dp/0470223642/ref=pd_sim_b_img_2">Professional Adobe Flex 3</a></p>
<p>&nbsp;<img class="" alt="" border="0" src="http://ecx.images-amazon.com/images/I/41jZRmjwuxL._AA240_.jpg" /></p>
<p class="paragraph">5. <a href="http://www.amazon.com/Flex-Cookbook-Code-Recipes-Tricks-Developers/dp/0596529856/ref=pd_sim_b_img_3">Flex 3 Cookbook</a></p>
<p><img class="" alt="" border="0" src="http://ecx.images-amazon.com/images/I/51UifTt-rzL._AA240_.jpg" /></p>]]></description>
		</item>
		
</channel>
</rss>