參考資料:
注意事項:
1.Flex 3必須指定 services-config.xml
(主要是爲了找到 remoting-config.xml 中的 <destination /> 的id)
方法一:Project Properties > Flex Compiler > Additional compiler arguments:
-locale en_US -services "x:\...\FlexWebSite\WEB-INF\flex\services-config.xml"
或使用相對路徑 "..\..\WEB-INF\flex\services-config.xml"
方法二:直接在Flex3 > .actionScriptProperties 文件中設置
<compiler additionalCompilerArguments=
"-locale en_US -services "..\..\WEB-INF\flex\services-config.xml"" .../>
2. 其餘信息可在 Flex3 > .flexProperties 中設置
<flexProperties aspUseIIS="true" flexServerType="32" serverContextRoot="/FlexWebSite" serverRoot="H:/.../FlexWebSite" serverRootURL="http://localhost:4776/FlexWebSite/" toolCompile="true" useServerFlexSDK="false" version="1"/>
3.Flex3與ASP.NET 中 <destination id="fluorine"> 的AMF 網關通信
- 可使用第三方actionscript庫 RemoteObjectAMF0 實現
- 使用 <mx:RemoteObject />
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:RemoteObject id="service" destination="fluorine"
source="ServiceLibrary.Sample">
<mx:method name="Echo" result="onResult(event)">
</mx:method>
</mx:RemoteObject>
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
internal function onClick():void
{
service.Echo(txtInput.text);
}
internal function onResult(evt:ResultEvent):void
{
txtResult.text = evt.result.toString();
}
]]>
</mx:Script>
<mx:Panel x="53" y="52" width="250" height="200" layout="absolute" title="測試FluorineFx" fontSize="12">
<mx:TextInput x="35" y="21" id="txtInput"/>
<mx:Button x="35" y="63" label="確 定" fontWeight="normal" click="onClick()"/>
<mx:Label x="35" y="95" text="結 果:"/>
<mx:TextInput x="35" y="123" width="160" id="txtResult"/>
</mx:Panel>
</mx:Application>
- 待續。。。