java后台+flex Cirangorm框架交互
[color=darkred][/color][size=x-large][/size][align=center][/align]创建一个flex项目,添加了cairngorm3.0的swc文件,利用cairngorm框架做个从后台查询数据库里的数据,然后在视图上显示
但是,出来时报错,下面是报错信息:
TypeError: Error #1006: faultHandler 不是函数。
at com.potevio.cairngorm.business::Services/__userRO_fault()[D:\myproject\CairmgormTest\flex_src\com\potevio\cairngorm\business\Services.mxml:7]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.rpc::AbstractService/dispatchEvent()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\AbstractService.as:333]
at mx.rpc.remoting.mxml::RemoteObject/dispatchEvent()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\remoting\mxml\RemoteObject.as:148]
at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\AbstractOperation.as:254]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.rpc::AsyncDispatcher/timerEventHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\AsyncDispatcher.as:50]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
service.mxml是remoteObject的配置文件
<?xml version="1.0" encoding="utf-8"?>
<cairngorm:ServiceLocator
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:cairngorm="com.adobe.cairngorm.business.*">
<!--定义remoteObject的各项参数和方法-->
<mx:RemoteObject
id="userRO"
destination="userService"
showBusyCursor="true"
result="event.token.resultHandler( event );"
fault="event.token.faultHandler( event );">
</mx:RemoteObject>
</cairngorm:ServiceLocator>
我的delegate.as如下获取service,并且调用后台方法:
package com.potevio.cairngorm.business
{
import com.adobe.cairngorm.business.Responder;
import com.adobe.cairngorm.business.ServiceLocator;
import com.potevio.cairngorm.model.SaveUserLocator;
import mx.rpc.AsyncToken;
import mx.rpc.IResponder;
import mx.rpc.events.*;
public class ShowUsersDelegate
{
private var responder:Responder;
private var userModel:SaveUserLocator = SaveUserLocator.getInstance();
private var serviceLocator:ServiceLocator = ServiceLocator.getInstance();
private var userService:Object;
public function ShowUsersDelegate(iresponder:Responder)
{
this.responder = iresponder;
}
public function getUsers():void{
this.userService = this.serviceLocator.getRemoteObject("userRO");
var call:AsyncToken = this.userService.getUsers();
call.resultHander = responder.onResult;
call.faultHander = responder.onFault;
}
}
}
remoting-config.xml配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service"
default="true"/>
</adapters>
<default-channels>
<channel ref="my-amf"/>
</default-channels>
<destination id="userService">
<properties>
<source>com.potevio.service.userImpl.UserService</source><--------UserService是Java后台的一个类--------->
</properties>
</destination>
</service>
请问,我这是哪里出问题了,为什么不能够正常执行呢?
是配置文件的问题吗?
我现在很纳闷4.0的service.mxml的remoteObject的配置方式以及在delegate内如何调用?
劳烦高手相告!
1 楼 Apache_007 2012-08-06 没人知道吗? 2 楼 TiFa.L.Hart 2012-08-31 Apache_007 写道没人知道吗?
我Flex菜鸟路过打酱油滴,不知道你这个问题解决了木,其实哥,你不应该在这里提问的,这里是博客,若有问题到Iteye的问答那里问,应该会好点,反正我觉得在iteye里找资源还可以,问问题就....(我没问过)