我想我真的很菜鸟时刻,我从coldfusion返回一个远程对象,我想指定对象类型。即我从coldfusion 得到一个工人,我有一个价值对象工人。
这是我一直在尝试的
public function ResultHandler_GetWorker(event:ResultEvent):void
{
var result:ArrayCollection = ArrayCollection(event.result);
var worker:WorkerVO = WorkerVO(result[0]);
model.worker = worker;
}
Result[0]
是一个雇员对象。它的调试结构看起来像这样。
workerAddress "24b fake Ave"
workerCity "Wellton"
workerCountry "Ameriland" workerEmail "Afake@me.com"
workerFName "Foo"
workerHPhone "435234"
workerID 1
workerImage null
workerIsAdmin true
workerLName "Foo"
workerMPhone "827271903" workerPassword "password"
workerPosition "领导者"
workerState""
workerSuburb"Birkenhead"
workerWPhone null
我的课看起来像这样:
public class WorkerVO
{
public var _workerAddress:String
public var _workerCity:String
public var _workerCountry:String
public var _workerEmail:String
public var _workerFName:String
public var _workerHPhone:String
public var _workerID:uint;
public var _workerImage:String
public var _workerIsAdmin:Number;
public var _workerLName:String
public var _workerMPhone:String;
public var _workerPassword:String;
public var _workerPosition:String;
public var _workerState:String;
public var _workerSuburb:String;
public var _workerWPhone:String;
public function WorkerVO()
{
}
//Getters & Setters
}
错误 #1034:类型强制失败:无法将 Object@114eeb251 转换为 com.cavej03.sitesafe.vo.WorkerVO。
我做错了吗。我只是想创建一个函数或构造函数来接受这个对象并将其字段映射到一个新的 WorkerVO