You might have already read about Array oddity in AMFPHP/Flex 2. AS3 Associative Arrays, when sent through AMF0 they include ‘length’ propery. But numeric index based Arrays are fine.
I’ve created the following AMFPHP Service to showcase this issue. It is a simple service with a remote method that converts any given object to string and returns it.
Then I’ve created a Flash 9 AS3 Fla to send different combinations of data to this service. here is the script that does it all.
Here is the result.
Now we can clearly see what is happening. so here is what I suggest
- If you need to send index based Array, no problem use Array
- If you need to send key value pairs, use Object instead
- If you can ignore the ‘length’ property on the server side you may still use Associative Array
- Else you may keep the simple Array as one of the elements of your Object and send the Object