Perspective Shadow and the Transformation Matrix in AS3

I read Senocular’s brilliant tutorial on Understanding the Transformation Matrix in Flash 8. I don’t think I’ve ever seen an internet tutorial on any subject that was put together better than this one–kudos Sen!

I’m attempting to create a dynamic perspective shadow system in Flash 9 (AS 3) that would have the following constructor:

ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#0000FF]public[/COLOR] [COLOR=#000000]**function**[/COLOR] PShadow[COLOR=#000000]([/COLOR]mcClipToShadow:[COLOR=#0000FF]MovieClip[/COLOR], nAngle:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]45[/COLOR], nDistance:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]20[/COLOR], nAlpha:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]90[/COLOR], nBlur:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]10[/COLOR], nXOffset:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]0[/COLOR], nYOffset:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]0[/COLOR][COLOR=#000000])[/COLOR]

[COLOR=#000000]{[/COLOR]
[COLOR=#808080]//do stuff[/COLOR]
[COLOR=#000000]}[/COLOR]
[/LEFT]
[/FONT]

The function would duplicate the mcClipToShadow MovieClip to use as the base shadow, apply a 100% black tint, set the alpha to nAlpha, and apply a blur filter with Blur X = Blur Y = nBlur. Then a transformation Matrix would be applied that would skew the shadow sprite so that it was cast in the nAngle direction with length nDistance.

The only part that I’m having trouble with is solving the math for the Matrix. I’ve played a lot with the swf’s in your tutorial to better understand how the matrix manipulates things, but I’m still having troubles doing the math properly. My goal is to simply plugin the variables from the constructor into the Matrix constructor and the proper shadow will result.

Any suggestions?

Thanks!
~JC