amfPhp
調了很久才發現在flex 2中不用設置amf的版本,而且服務器端amfphp是1.2.5或1.9都行得通。如果是amfphp1.9的話,還可以省去methodTable定義。
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:TextArea id="amfphptest" width="200"/>
<mx:Button label="call amfphp" click="callAmfPHP(amfphptest.text)" />
<mx:Script>
<![CDATA[
import flash.net.Responder;
import flash.net.NetConnection;
private var gateway_url:String = "http://www.flashxm.com/amfphp/gateway.php";
private var geteway_conn:NetConnection = new NetConnection();
public function callAmfPHP(str:String):void
{
geteway_conn.connect(gateway_url);
geteway_conn.call("HelloWorld.phpSay", new Responder(onResult, onFault), str);
}
private function onResult(result:Object):void
{
amfphptest.text = result.toString();
}
private function onFault(fault:String):void
{
amfphptest.text = fault;
}
]]>
</mx:Script>
</mx:Application>
其中mx:Script部分簡直就等於flash actionscript!
此信息來自〖閃無憂〗
查看原網址:http://www.5uflash.com/Html/flex/10395766.html
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:TextArea id="amfphptest" width="200"/>
<mx:Button label="call amfphp" click="callAmfPHP(amfphptest.text)" />
<mx:Script>
<![CDATA[
import flash.net.Responder;
import flash.net.NetConnection;
private var gateway_url:String = "http://www.flashxm.com/amfphp/gateway.php";
private var geteway_conn:NetConnection = new NetConnection();
public function callAmfPHP(str:String):void
{
geteway_conn.connect(gateway_url);
geteway_conn.call("HelloWorld.phpSay", new Responder(onResult, onFault), str);
}
private function onResult(result:Object):void
{
amfphptest.text = result.toString();
}
private function onFault(fault:String):void
{
amfphptest.text = fault;
}
]]>
</mx:Script>
</mx:Application>
其中mx:Script部分簡直就等於flash actionscript!
此信息來自〖閃無憂〗
查看原網址:http://www.5uflash.com/Html/flex/10395766.html
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.