AMFPHP – Index out of bounds.
I recently used a lot of time on this issue which exists when using AMFPHP.
the scenario:
I used a NetConnection to access an amfphp gateway. But everytime I ran my application I got a runtime error saying RangeError: Index out of bounds.
I tried to catch the error, but it seemed to happen between my call to NetConnection.call() and the callback to the Responder().
After a few hours I finally found out that my php populated an array with values in the following way
$array[1] = value1;
$array[2] = value2;
$array[3] = value3;
… and so on, skipping the 0 index.
this is perfectly alright with php. I suppose it acts like an associative array even though the keys are numeric.
But when it entered Flash it got translated into an Array instead of an Object resulting in the RangeError because the 0 index didn’t exist.
As soon as I added data to the missing 0 index everything ran smoothly.