When using E4X (AS3) to test whether an attribute exists, if you write:
var nX:Number = (shape@nY) ? shape@nY : 0;
an exception will be thrown. You should instead write:
var nX:Number = (shape.attribute('nY').toString()) ? shape@nY : 0;
I had hoped that Flash/Flex/AS3 had an hasAttribute method, but I guess this will do.