Help Printing from Flash

Hi,

I am new adding print functions in Flash. I found a code that prints my swf correctly, but only if I right click print. I tried to make it so that when my print_btn is pressed the stage is printed, but when I try to add this to the pre-existing code things get messed up and nothing prints.

Any suggestions about how to get my print_btn working are appreciated!

This the pre-existing code:

 function PrintScreenShot (target:MovieClip)
	{
		//snapShot(target);

		_screenshot_mc = _root.createEmptyMovieClip ( "screenshot_mc" , _global._depth++ );
		_screenshot = new BitmapData(target._width, target._height, _bTransparent, _bgColor);
		_screenshot.draw(target);
		_screenshot_mc.attachBitmap (_screenshot ,_global._depth++);

		var topLeft 	= 0;
		var topRight	= _screenshot_mc._width;
		var bottomLeft	= 0;
		var bottomRight	= _screenshot_mc._height;

		_printJob = new PrintJob ();

		if ( _printJob.start () )
		{
			if ( _printJob.addPage( _screenshot_mc , { xMin:topLeft , xMax:topRight , yMin:bottomLeft , yMax:bottomRight } , { printAsBitmap:true } ) )
			{
				_printJob.send ();
			}
		}

		delete _printJob;
		
	
		_root.removeMovieClip( "screenshot_mc" );
		_screenshot.dispose ();
	}