Unable to parse null body data Invalid user property in Zend Amf

It's the property/variable mismatch in Amf Object and PHP VO(Virtual Object) class objects

Definition spark.effects:AnimateFilter could not be found.

You  are using the old sdk version. Spark supports available from sdk 4. Please add/update your sdk from Project Properties menu in Flash Builder

Access of undefined property JSON

First we have to download the library and can find it at http://code.google.com/p/as3corelib/. Then follow these steps to add your JSON library to your Flex project:

   1. Download the .zip archive and extract it. What you need is the .swc file in the lib folder.
   2. In Flex Builder / Flash Builder, go to your project’s properties, and then to the Flex Build Path panel.
   3. Click on Add SWC, and select the as3corelib.swc file
   4. In your project, add the following line: import com.adobe.serialization.json.JSON;

Error:Process terminated without establishing connection to debugger. initial content not found

I managed to find a solution to the problem. It has to do with outdated app xml config files.
So after importing project from source control, create a new application (eg. TestApp) and run / debug it, which works fine.

Compare the 2 app xml config files. In the new file at the top you will see a line:
application xmlns="http://ns.adobe.com/air/application/1.5"
In the old file I had:
application xmlns="http://ns.adobe.com/air/application/1"

So you can change the old with the new app configuration.

Error - Invalid application descriptor: descriptor version does not match runtime version

It's because of your SDK version and has some incompatibility with main-app.xml in the application root folder.
   It happens when you import some application so better to create test application with existing SDK version. Then replace the application main-app.xml with the automatically created one.

Using Zend_Amf with Flex

We have to do the following from flex script
1. Setting a target url
There are different ways to do it and I share one of them.
We need to create service-config.xml and save that in the project src folder.
Ex:
services-config
services
service id="amfphp-flashremoting-service" class="flex.messaging.services.RemotingService" messageTypes="flex.messaging.messages.RemotingMessage"
destination id="flex_amf"
channels
channel ref="my-zend"
channels
properties
source*Flex Compiler settings.
Ex:-locale en_US -services service-config.xml
3. In your mxml file add RemoteObject component
Ex:

In this source is the class name that you are using in PHP and destination refers to destination tab in the service-config.xml file
4. Create a button to execute the click function and in that call the function you need to execute in the class file.
zendRemoteObject.functionName(parameters)
5. You will get the amf response in the result or fault event functions

You have to do the folloing in PHP class to return the amf response.

1. Include the Zend_Amf library
Ex:
require_once 'Zend/Amf/Server.php';
2. Create object of amf server
$server = new Zend_Amf_Server();
3. Set the class that we need to map with
$server->setClass("className");
4. Map ActionScript value objects to the PHP value objects.
$server->setClassMap("className", "className");
5. Then print the handle response.
Ex:echo ($server->handle());

Create associative array in Flex

It's not possible to create array like array('branchId'=>1,'order'=>2)
For that first we have to define a variable as array
Ex:
var attr:Array = new Array();
attr["branchId"] = 1;
attr["order"] = 2;

Geneate/Create ArrayCollection dynamically

var resultArr:ArrayCollection = new ArrayCollection(e.result as Array);
var careeListData:ArrayCollection = new ArrayCollection();
var resultArray:Array = new Array();
if((resultArr.length > 0) && (resultArr[0]["whoForId"] != null)){

for(var l=0; l < resultArr.length; l++){

resultArray.push({label:resultArr[l]["careeName"], data:resultArr[l]["whoForId"]})

}
careeListData = resultArray as Object;
}

Combobox with change event to get the selected item value

In the script add the following

private var listData:ArrayCollection = new ArrayCollection(
[{label:"Arun Kumar", data:"3"},
{label:"John Jose", data:"1"},
{label:"Mary Dam", data:"2"}]);
private function getSelectedCaree(event:Event):void
{
trace(event.currentTarget.selectedItem.data);
}

In the MXML add the following to show the combo-box with change event

mx:ComboBox id="comboList" change="getSelectedCaree(event)" fontSize="15" x="1000" y="50" dataProvider="{listData}"
/mx:ComboBox

Confirmation Alert box with OK and Cancel

Alert.show("Do you want to remove all the events", "Confirmation",
Alert.OK | Alert.CANCEL, this,
confirmRemove, null, Alert.OK);

private function confirmRemove(evntObj:CloseEvent):void
{
if (evntObj.detail==Alert.OK) {
//Add the code to execute if use pressed OK button
}
}