不知道为什么 RPCDataServiceAdapter 会弹出错误。有一部分脚本与错误相关。
public function normalusercontactdatagrid_creationCompleteHandler(event:FlexEvent):void
{
getAllNormaluserResult.token = normaluserService.getAllNormaluser();
}
protected function addUSER(event:MouseEvent):void
{
var win:IFlexDisplayObject =PopUpManager.createPopUp(this, addUser, true) as IFlexDisplayObject;
PopUpManager.centerPopUp(win);
var e:FlexEvent;
normalusercontactdatagrid_creationCompleteHandler(e);
}
但显示以下数据适配器错误
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at mx.data::RPCDataServiceAdapter/processDataMessage()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\RPCDataServiceAdapter.as:987]
at RPCDataServiceRequest/invoke()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\RPCDataServiceAdapter.as:1786]
at mx.data::DataStore/http://www.adobe.com/2006/flex/mx/internal::invoke()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\DataStore.as:3497]
at Function/<anonymous>()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\DataStore.as:1716]
at Function/<anonymous>()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\DataStore.as:1584]
at mx.data::DataStore/http://www.adobe.com/2006/flex/mx/internal::fill()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\DataStore.as:1771]
at mx.data::ConcreteDataService/internalFill()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\ConcreteDataService.as:7504]
at Function/<anonymous>()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\ConcreteDataService.as:1306]
at mx.data::ConcreteDataService/fill()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\ConcreteDataService.as:1325]
at mx.data::ConcreteDataService/executeQuery()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\ConcreteDataService.as:1607]
at mx.data::DataManager/executeQuery()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\DataManager.as:1493]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.data::ManagedOperation/queryProxy()[C:\depot\DataServices\branches\milestone\lcds45_fb45\frameworks\projects\data\src\mx\data\ManagedOperation.as:519]
at mx.rpc.remoting::Operation/send()[E:\dev\4.y\frameworks\projects\rpc\src\mx\rpc\remoting\Operation.as:212]
at _Super_NormaluserService/getAllNormaluser()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\services\normaluserservice\_Super_NormaluserService.as:244]
at normalUserDetailComp/normalusercontactdatagrid_creationCompleteHandler()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\normalUserDetailComp.mxml:80]
at normalUserDetailComp/addUSER()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\normalUserDetailComp.mxml:93]
at normalUserDetailComp/___normalUserDetailComp_LinkButton1_click()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\normalUserDetailComp.mxml:172]
第 80 行、第 93 行和第 172 行的错误
是
line 80 getAllNormaluserResult.token = normaluserService.getAllNormaluser();
line 93 normalusercontactdatagrid_creationCompleteHandler(e);
line 172 <mx:LinkButton label="Add" click="addUSER(event);"/>
如果我正确理解错误堆,我认为这些行会触发 dataService 中的错误,即
at _Super_NormaluserService/getAllNormaluser()[C:\Users\School\Adobe Flash Builder 4.6\FYPadminSideV3\src\services\normaluserservice\_Super_NormaluserService.as:244]
这怎么可能发生?我该怎么办?
我发现如果我不在弹出窗口中调用 adduser.mxml ,错误将不会再次显示。adduser.mxml 如下所示
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:valueObjects="valueObjects.*"
xmlns:userservice="services.userservice.*"
xmlns:normaluserservice="services.normaluserservice.*"
xmlns:specialcareuserservice="services.specialcareuserservice.*"
width="522" height="732">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import services.*;
protected function button_clickHandler(event:MouseEvent):void
{
var userService:UserService = new UserService();
var user2:User = new User();
user2.idUser = parseInt(idUserTextInput.text);
user2.userName = userNameTextInput.text;
user2.password = passwordTextInput.text;
createUserResult.token = userService.createUser(user2);
userService.commit();
var normaluserService:NormaluserService = new NormaluserService();
var normaluser2:Normaluser = new Normaluser();
normaluser2.user_idUser = parseInt(idUserTextInput.text);
normaluser2.userFristName = userFristNameTextInput.text;
normaluser2.userSecondName = userSecondNameTextInput.text;
normaluser2.userAddress_Flat = userAddress_FlatTextInput.text;
normaluser2.userAddress_Floor = userAddress_FloorTextInput.text;
normaluser2.userAddress_Bulding = userAddress_BuldingTextInput.text;
normaluser2.userAddress_Street = userAddress_StreetTextInput.text;
normaluser2.userAddress_Dist = userAddress_DistTextInput.text;
normaluser2.userAddress_Country = userAddress_CountryTextInput.text;
createNormaluserResult.token = normaluserService.createNormaluser(normaluser2);
normaluserService.commit();
var specialcareuserService:SpecialcareuserService = new SpecialcareuserService();
var specialcareuser2:Specialcareuser = new Specialcareuser();
specialcareuser2.specialCareRequirement_idspecialCareRequirement = parseInt(specialCareRequirement_idspecialCareRequirementTextInput.text);
specialcareuser2.user_idUser = parseInt(idUserTextInput.text);
createSpecialcareuserResult.token = specialcareuserService.createSpecialcareuser(specialcareuser2);
specialcareuserService.commit();
}
]]>
</fx:Script>
<fx:Declarations>
<valueObjects:User id="user"/>
<userservice:UserService id="userService"
fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
showBusyCursor="true"/>
<s:CallResponder id="createUserResult"/>
<valueObjects:Normaluser id="normaluser"/>
<normaluserservice:NormaluserService id="normaluserService"
fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
showBusyCursor="true"/>
<s:CallResponder id="createNormaluserResult"/>
<valueObjects:Specialcareuser id="specialcareuser"/>
<specialcareuserservice:SpecialcareuserService id="specialcareuserService"
fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
showBusyCursor="true"/>
<s:CallResponder id="createSpecialcareuserResult"/>
</fx:Declarations>
<s:Form x="43" y="10" width="445" height="727" >
<s:FormItem label="IdUser">
<s:TextInput id="idUserTextInput" text="{user.idUser}"/>
</s:FormItem>
<s:FormItem label="UserName">
<s:TextInput id="userNameTextInput" text="{user.userName}"/>
</s:FormItem>
<s:FormItem label="Password">
<s:TextInput id="passwordTextInput" text="{user.password}"/>
</s:FormItem>
<s:FormHeading width="266" label="User Detail (Name, address...)"/>
<s:FormItem label="Frist Name">
<s:TextInput id="userFristNameTextInput" text="{normaluser.userFristName}"/>
</s:FormItem>
<s:FormItem label="Second Name">
<s:TextInput id="userSecondNameTextInput" text="{normaluser.userSecondName}"/>
</s:FormItem>
<s:FormItem label="Flat">
<s:TextInput id="userAddress_FlatTextInput" text="{normaluser.userAddress_Flat}"/>
</s:FormItem>
<s:FormItem label="Floor">
<s:TextInput id="userAddress_FloorTextInput" text="{normaluser.userAddress_Floor}"/>
</s:FormItem>
<s:FormItem label="UserAddress_Bulding">
<s:TextInput id="userAddress_BuldingTextInput" text="{normaluser.userAddress_Bulding}"/>
</s:FormItem>
<s:FormItem label="Street">
<s:TextInput id="userAddress_StreetTextInput" text="{normaluser.userAddress_Street}"/>
</s:FormItem>
<s:FormItem label="Dist">
<s:TextInput id="userAddress_DistTextInput" text="{normaluser.userAddress_Dist}"/>
</s:FormItem>
<s:FormItem label="Country">
<s:TextInput id="userAddress_CountryTextInput" text="{normaluser.userAddress_Country}"/>
</s:FormItem>
<s:FormHeading label="Special Requirement"/>
<s:FormItem label="Care Requirement">
<s:helpContent>
<s:VGroup>
<s:Label text="Special Requirement?"></s:Label>
</s:VGroup>
</s:helpContent>
<s:TextInput id="specialCareRequirement_idspecialCareRequirementTextInput"
text="{specialcareuser.specialCareRequirement_idspecialCareRequirement}"/>
</s:FormItem>
<s:Button id="button" label="CreateUser" click="button_clickHandler(event)"/>
</s:Form>
</s:Group>