Code striaght from Help File?

This is straight from the MX help fill but doesn’t work…

Can anyone tell me why ?

_root.createEmptyMovieClip( "grad", 1 );
                with ( _root.grad )
  
                {
  
                colors = [ 0xFF0000, 0x0000FF ];
                alphas = [ 100, 100 ];
                ratios = [ 0, 0xFF ];
                matrix = { matrixType:"box", x:100, y:100, w:200, h:200, r:(45/180)*Math.PI }; 
                beginGradientFill( "linear", colors, alphas, ratios, matrix );
                moveto(100,100);
                lineto(100,300);
                lineto(300,300);
                lineto(300,100);
                lineto(100,100);
                endFill();
                }