当使用Flex调用.Net方法时,远程调用会出现一个转换错误。错误说:
无法将“FluorineFx.ASObject”类型的对象强制转换为com.mynamespace.MyAccessControlType类型
调用者是flex,服务在.net中提供。它使用FlourineFx通信/桥接双方。
flex调用类似于:
public class SavePageDelegate
{
private var responder:IResponder;
private var service:RemoteObject;
public function SavePageDelegate(page:PageType, responder:IResponder):void
{
this.service = ServiceLocator.getInstance().SavePage(page);
this.responder = responder;
}
}远程方法与下一步相同。请注意,页面对象的发送没有问题。页面对象具有权限( ArrayList,AccessControlList)的权限(MyAccessControlType)。当我试图使用foreach访问一个元素时,会引发错误:
/* this is called from Flex*/
public string SavePage(PageType page){
...
InsertAccessControl(page.AccessControlList);
}
/* This is called from SavePage */
public void InsertAccesControl(System.Collections.ArrayList AccessControlList);
{
// This is the line where the error is triggered
foreach (com.mynamespace.MyAccessControlType item in AccessControlList)
{
...
}
}我使用这些页面作为参考:http://www.fluorinefx.com/docs/fluorine/typeconversion.html -显示了Fluorine / Flex对象的有效类型转换
http://www.fluorinefx.com/docs/fluorine/classmapping.html -用于类映射。
发布于 2013-10-09 21:43:24
在flex声明中,您似乎缺少了MyAccessControlType的映射,因为它被视为通用的AsObject。
映射如下:
[RemoteClass(alias="com.mynamespace.MyAccessControlType")]这样您就可以看到完整的远程类,从而解决转换问题。希望这能有所帮助。
https://stackoverflow.com/questions/19282688
复制相似问题