Problem:
I call a PHP file using an HTTPService. I set the result of this HTTPService to a function which populates a testTextArea with whatever the PHP file has returned (echoed). This work fine when I run the application from flash builder i.e. I get strings in the testTextArea, echoed by my PHP file. But this does not work fine when I make the Release of the project and the testTextArea gets populated by the whole code of PHP file.
Code:
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()"/>
The problem was arising because I was mistakenly running my html file from harddisk by double clicking it i.e. I wasn't running it with localhost.