1.flex中 as与java对象对应时 只需要在as类上加
import mx.collections.ArrayCollection;
?[Bindable]
?[RemoteClass(alias="com.cl.crm.entity.EmployeesInfo")]
?public class EmployeesInfo
?{
??public function EmployeesInfo()
??{
??}
2.java实体类中多对多时 的HashSet 类型 在 as中对应的类型是? ArrayCollection
java:
private Set<salechanceInfosForScAssign> salechanceInfosForScAssign = new HashSet<salechanceInfosForScAssign>();
as:
public var salechanceInfosForScAssign:ArrayCollection= new ArrayCollection();
3.as对象中调用属性值时貌似不用 set get 方法 直接就能取到值
4. mxml文件中调用远程对象的方法
??? (1)mxml文件中配置(就在这个页面中使用。。)
?<mx:RemoteObject destination="java.Stat" id="Stat">
??<mx:method name="getCutomerContribute" result="returnCutomerContribute(event)"/>? <!--getCutomerContribute远程调用的方法? 和此方法对应的回调函数returnCutomerContribute()-->
?</mx:RemoteObject>
? (2)在as 中new出来(动态调用)
????
?var employeService:RemoteObject=new RemoteObject("EmployeeService");//new一个远程对象
??employeService.addEventListener(FaultEvent.FAULT,getEmployeeFalse); //调用失败时的回调函数
??employeService.addEventListener(ResultEvent.RESULT,getEmployeeOk);//调用成功时的回调函数
//调用远程方法后 的回调函数
??private function getEmployeeOk(eve:ResultEvent):void{??????????????????????????//回调方法中 的事件类型一定要注意 和定义的一样 要不报错
??if(eve.result !=null){
??var emp:Employee =Employee(eve.result);
??///var request:URLRequest = new URLRequest("main.html");
??//navigateToURL(request,"_self");
??? }else{
??? Alert.show("密码错误!请从新填写","提示");
??? }
??
??}
??//(回调函数)
??private function getEmployeeFalse(event:FaultEvent):void{
??//保存登录成功用户
??//session.setAttribute("EmpRoles",event.result);
??//登陆成功跳转
???Alert.show("远程调用EmployeeService失败!!"+event.fault.message);
??}
??-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
远程调用中404错误解决办法!!!!!!{context.root}改成你的项目名称
endpoint的问题,在services-config.xml文件中,由于此类型的endpoint:?
<endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>,中的{context.root}获取不到项目名称。?
?
5 flex 也可以像struts2 那样在前台直接取出 对象的属性值?? (只要指定了 java对象 和as对象间的关系就OK了) 感觉还是没有struts2 好用 用flex最大的优点是省了美工了。。。。。。。。
6ActionScript编写的模块,不能由ModuleLoader来加载使用,只能用ModuleManager。MoudleLoader只能加载MXML的模块,而ModuleManager既可以加载MXML模块,也可以加载ActionScript编写的模块