我打電話使用的HTTPService的PHP文件。我將這個HTTPService的結果設置爲一個函數,該函數用PHP文件返回(回顯)填充testTextArea。這個工作很好,當我從Flash builder運行應用程序時,即我得到了testTextArea中的字符串,並由我的PHP文件迴應。但是,當我使項目的發佈和testTextArea被PHP文件的整個代碼填充時,這不起作用。
代碼:
private function addUserServiceHandler(event:ResultEvent):void{
testTextArea.text = event.result.toString(); //This outputs the whole php file in to the textArea as if it were a string
}
private function saveButtonClicked():void{
addUserService.send();
}
]]>
</fx:Script>
<fx:Declarations>
<mx:HTTPService id="addUserService" url="addUser.php" resultFormat="text" method="POST" result="addUserServiceHandler(event)" >
<mx:request xmlns="">
<firstName>{firstNameTextInput.text}</firstName>
<lastName>{lastNameTextInput.text}</lastName>
<imageName>{uploadTextInput.text}</imageName>
<adultContent>{adultContentRadioGroup.selectedValue}</adultContent>
<p2p>{p2pRadioGroup.selectedValue}</p2p>
<priority>{priorityRadioGroup.selectedValue}</priority>
</mx:request>
</mx:HTTPService>
<fx:Declarations>
<s:Button id="saveButton" includeIn="AddUser" x="313" y="128" label="Save" width="187" height="33" click="saveButtonClicked()"/>
這可能只是一個'crossdomain.xml'問題? – Jakub 2011-02-23 15:31:22
不知道...當我用Flex 3工作時,從來沒有遇到過這個問題 – baltoro 2011-02-23 15:44:52
那麼你有沒有一個crossdomain.xml文件可以訪問該PHP文件?我假設它可能被阻止..爲什麼不嘗試在飛行中調試?我不能告訴你什麼是錯的,我給你的建議,你需要有'想法' – Jakub 2011-02-23 15:48:05