Z problem with 3d lines

Hello,
I would like to link the red squares to the blue square in 3D with CS4 only (please no papervision or sandy…)
I’m very closed to the solution but I still have a wrong z (visible when you move the mouse to a corner for instance)

The animation is visible here:
http://bractar.phpnet.org/test.swf

The as code is available here:
http://bractar.phpnet.org/Test.as

The main function is drawLines()

Thank you for your help