私はフレックスアプリケーションのチュートリアルに従っており、ほとんどのエラーを修正できましたが、これには完全に困惑しています。
id、Firstname、Lastname、Title、Birthday、Cellphone、Officephone、Email、Address、photofile という列を持つ、employees というデータテーブルがあります。
アプリケーションはシンプルです。HomeView にすべての従業員を一覧表示し、従業員をタップすると DetailView に移動し、そこにすべての追加情報が表示されます。ただし、毎回、「ReferenceError: エラー #1056: valueObjects.Employees にプロパティ Address を作成できません。」というメッセージが表示されます。
DetailView のコードは次のとおりです。
xmlns:employeesservice1="services.employeesservice1.*"
overlayControls="false"
title="{getEmployeesByIDResult.lastResult.Firstname} {getEmployeesByIDResult.lastResult.Lastname}"
viewActivate="view1_viewActivateHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
import spark.events.ViewNavigatorEvent;
import mx.rpc.events.ResultEvent;
protected function goBack(event:Event):void
{
navigator.pushView(EmployeeListerHomeView);
}
protected function getEmployeesByID(itemID:int):void
{
getEmployeesByIDResult.token = employeesService1.getEmployeesByID(itemID);
}
protected function view1_viewActivateHandler(event:ViewNavigatorEvent):void
{
this.addElement(busyIndicator);
getEmployeesByID(data as int);
}
protected function getAllEmployeesResult_resultHandler(event:ResultEvent):void
{
this.removeElement(busyIndicator);
}
]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="getEmployeesByIDResult" result="getAllEmployeesResult_resultHandler(event)"/>
<employeesservice1:EmployeesService1 id="employeesService1"/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:navigationContent>
<s:Button id="backBtn" click="goBack(event)">
<s:icon>
<s:MultiDPIBitmapSource source160dpi="@Embed('assets/save160.png')"
source240dpi="@Embed('assets/save240.png')"
source320dpi="@Embed('assets/save320.png')"/>
</s:icon>
</s:Button>
</s:navigationContent>
<s:Image x="10" y="10" width="100" height="100"
source="http://localhost/EmployeeLister/assets/{getEmployeesByIDResult.lastResult.photofile}128x128.png" />
<s:VGroup width="100%" height="100%" gap="10" paddingLeft="120">
<s:Label fontWeight="bold" paddingTop="10" text="Title"/>
<s:Label text="{getEmployeesByIDResult.lastResult.Title}"/>
<s:Label fontWeight="bold" paddingTop="10" text="Cell Phone"/>
<s:Label text="{getEmployeesByIDResult.lastResult.Cellphone}"/>
<s:Label fontWeight="bold" paddingTop="10" text="Office Phone"/>
<s:Label text="{getEmployeesByIDResult.lastResult.Officephone}"/>
<s:Label fontWeight="bold" paddingTop="10" text="Email"/>
<s:Label text="{getEmployeesByIDResult.lastResult.Email}"/>
<s:Label fontWeight="bold" paddingTop="10" text="Address"/>
<s:Label text="{getEmployeesByIDResult.lastResult.Address}"/>
</s:VGroup>
<s:BusyIndicator id="busyIndicator" verticalCenter="0" horizontalCenter="0" symbolColor="red"/>
ここで注意すべき点: EmployeesService1 を作成した後で、Cellphone、Officephone、Email、および Address 列を追加したため、.php を編集してこれらの新しい値を含める必要がありました。だから私はそこで何か間違ったことをしたのではないかと心配していますが、タイプミスを3回チェックしましたが、他の値にエラーが発生していないので、わかりません. 繰り返しますが、これにはかなりイライラしています。サービスのすべての操作をテストしたところ、すべて適切な値が返されました。
.php の関数は次のとおりです。 public function getEmployeesByID($itemID) {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where id=?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'i', $itemID);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_bind_result($stmt, $row->id, $row->Firstname, $row->Lastname, $row->Title, $row->Birthday, $row->Cellphone, $row->Officephone, $row->Email, $row->Address, $row->photofile);
if(mysqli_stmt_fetch($stmt)) {
$row->Birthday = new DateTime($row->Birthday);
return $row;
} else {
return null;
}
}
正確な答えがわからない場合でも、何が起こっているのかを簡単に把握する方法はありますか? エラー ウィンドウのコール スタックは、すべて内部の flex/as3 のものです。ですから、必要がなければ、そのうさぎの穴に行きたくありません。
どんな助けでも大歓迎です。ありがとう!!!!