You're not referencing the array properly.
You have:
arrayfun[i].graphics.lineStyle(3,0x1111AA);
arrayfun[i].graphics.beginFill(0x222299);
arrayfun[i].graphics.drawRect(0,0,100,100);
arrayfun[i].graphics.endFill();
arrayfun[i].x = a;
arrayfun[i].y = b;
platformcontainer.addChild(arrayfun[i]);
That is looking for arrayfun[0], arrayfun[1], arrayfun[2], et al, which are not initialized.
You want this:
arrayfun[i].graphics.lineStyle(3,0x1111AA);
arrayfun['square'+i].graphics.beginFill(0x222299);
arrayfun['square'+i].graphics.drawRect(0,0,100,100);
arrayfun['square'+i].graphics.endFill();
arrayfun['square'+i].x = a;
arrayfun['square'+i].y = b;
platformcontainer.addChild(arrayfun['square'+i]);
arrayfun['square'+i] will end up being arrayfun['square1'], arrayfun['square2'], et cetera.
However I didn't actually run the code so there in theory could be something else wrong with it.