php的amf和flex通讯问题
这个例子中,为什么flex 调用的时候 不按顺序就出错,就是说PHP中的差别就是
require('D:/EmpireServer/ecshop/amfphp-2.1.1/Amfphp/Services/BaseAttribute.php');
语句出现的顺序。
edit_GetMaterialType_sq.php
<?php<br />class edit_GetMaterialType_sq<br />{<br />function IsLogin($isadmin)<br />{<br /> require('D:/EmpireServer/ecshop/amfphp-2.1.1/Amfphp/Services/BaseAttribute.php');<br /> $reLogin = array();<br /> $reLogin[] = 'IsLogin($isadmin)';<br /> return $reLogin;<br />}<br /><br />function get_materialtype()<br />{<br /> $g = array();<br /> $g[] = 'materialtype()' ;<br /> return $g;<br />}<br /><br />function get_templatetype($templateid,$userid)<br />{<br /> require('D:/EmpireServer/ecshop/amfphp-2.1.1/Amfphp/Services/BaseAttribute.php');<br /> $p = array();<br /> $p[] = 'get_templatetype' ;<br /> return $p ;<br />}<br />}<br />?>
<?php<br />class BaseAttribute<br />{<br /> var $Width = 0;<br /> var $Height = 0 ;<br />}<br />?>
<?xml version="1.0" encoding="utf-8"?><br /><s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"<br /> xmlns:s="library://ns.adobe.com/flex/spark"<br /> xmlns:halo="library://ns.adobe.com/flex/halo"<br /> xmlns:mx="library://ns.adobe.com/flex/mx"<br /> applicationComplete="application1_applicationCompleteHandler(event)"><br /> <br /> <fx:Script><br /><br /> <![CDATA[<br /> import mx.controls.Alert;<br /> import mx.events.FlexEvent;<br /> import mx.rpc.events.FaultEvent;<br /> import mx.rpc.events.ResultEvent;<br /> import mx.rpc.events.FaultEvent;<br /> import mx.rpc.remoting.RemoteObject; //RemoteObject,我认为相当于OLEDB的Connection,总的连接。<br /> <br /> <br /> <br /> protected function application1_applicationCompleteHandler(event:FlexEvent):void <br /> {<br /> // 在程序加载的时候运行该事件<br /> so.IsLogin(true) //注意这三行的顺序,不这样就出错<br /> so.get_materialtype() //注意这三行的顺序,不这样就出错<br /> so.get_templatetype(1,1) //注意这三行的顺序,不这样就出错<br /><br /> }<br /> public function RemoteFaultss(re:FaultEvent,title:String):void <br /> { <br /> Alert.show("Message:" +re.fault.content+":"+re.fault.faultDetail,title);<br /> }<br /> public function IsLoginRemoteResultss(re:ResultEvent):void<br /> { <br /> Alert.show( re.result.toString())<br /> <br /> }<br /> <br /> public function RemoteFault(re:FaultEvent,title:String):void <br /> { <br /> Alert.show("Message:" +re.fault.content+":"+re.fault.faultDetail,title);<br /> }<br /> public function IsLoginRemoteResult(re:ResultEvent):void<br /> { <br /> Alert.show( re.result.toString())<br /> <br /> }<br /> protected function button1_clickHandler(event:MouseEvent):void<br /> <br /> {<br /> <br /> // TODO Auto-generated method stub<br /> <br /> <br /> <br /> }<br /> <br /> public function RemoteFaults(re:FaultEvent,title:String):void <br /> { <br /> Alert.show("Message:" +re.fault.content+":"+re.fault.faultDetail,title);<br /> }<br /> public function IsLoginRemoteResults(re:ResultEvent):void<br /> { <br /> Alert.show( re.result.toString())<br /> <br /> }<br /> <br /> <br /><br /> ]]><br /> <br /> </fx:Script><br /> <br /> <fx:Declarations><br /> <s:RemoteObject id="so" destination="amfphp"<br /> source="edit_GetMaterialType_sq"><br /> <mx:method fault="{RemoteFaultss(event,'登录验证失败2')}" name="IsLogin"<br /> result="{IsLoginRemoteResultss(event)}"/><br /> <mx:method fault="{RemoteFault(event,'登录验证失败')}" name="get_materialtype"<br /> result="{IsLoginRemoteResult(event)}"/><br /> <mx:method fault="{RemoteFaults(event,'登录验证失败1')}" name="get_templatetype"<br /> result="{IsLoginRemoteResults(event)}"/><br /> <br /> </s:RemoteObject><br /> <br /> <!-- 将非可视元素(例如服务、值对象)放在此处 --><br /> <br /> </fx:Declarations><br /> <br /><br /><br /></s:Application>