BitmapData Error..Problem with converting

hi every one.

im trying to create a image downloader…
im having some problems with converting the MC…

here is my code:

 
stop();
/*
THIS CODE IF FOR DOWNLOADING sketch_mc THAT IS ON THE MAIN TIMELINE.
IN ADITION TO THAT CODE THERE IS A CODE TO PUT ON THE PAGE (PHP CODE).
/////////////////////////////////////////////////////////////////////
///////////////////////////THE PHP CODE//////////////////////////////
/////////////////////////////////////////////////////////////////////
if (isset($GLOBALS["HTTP_RAW_POST_DATA"]))
{
 // get bytearray
 $jpg = $GLOBALS["HTTP_RAW_POST_DATA"];
 // add headers for download dialog-box
 header('Content-Type: image/jpeg');
 header("Content-Disposition: attachment; filename=".$_GET['name']);
 echo $jpg;
}
/////////////////////////////////////////////////////////////////////
/////////////////////////END OF CODE/////////////////////////////////
/////////////////////////////////////////////////////////////////////
*/
import com.adobe.images.JPGEncoder;
var jpgSource:BitmapData = new BitmapData (sketch_mc.width, sketch_mc.height);
jpgSource.draw(sketch_mc);
var jpgEncoder:JPGEncoder = new JPGEncoder(85);
var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);
dwn_mc.addEventListener(MouseEvent.MOUSE_DOWN,downloadThis);
function downloadThis (arg:MouseEvent){
 
var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
var jpgURLRequest:URLRequest = new URLRequest("jpg_encoder_download.php?name=sketch.jpg");
jpgURLRequest.requestHeaders.push(header);
jpgURLRequest.method = URLRequestMethod.POST;
jpgURLRequest.data = jpgStream;
navigateToURL(jpgURLRequest, "_blank");
}
/*
///////////////////////////////////////////////////
HERE IS THE START OF IMAGES LOADER TO sketch_mc !!
///////////////////////////////////////////////////
*/
var imageLoader:Loader;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, loadXML);
loader.load(new URLRequest("IMAGE.xml"));
/////
function loadXML(e:Event):void {
 var xml=new XML(e.target.data);
 var xDoc:XMLDocument = new XMLDocument();
 xDoc.ignoreWhite=true;
 xDoc.parseXML(xml.toXMLString());
 loadImage(xDoc.firstChild.childNodes[0].firstChild);
 trace(xDoc.firstChild.childNodes[0].firstChild);
}
function loadImage([url:String):void](http://www.kirupa.com/forum/String):void) {
 // Set properties on my Loader object
 imageLoader = new Loader();
 imageLoader.load(new URLRequest(url));
 imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
}
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////

function imageLoaded(e:Event):void {
 
 sketch_mc.addChild(imageLoader);
}
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////

in addition to thet i post a code on the internet page… PHP…
the code in the begining…

i get this error when i run the file:

ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData()
at DwnImg_fla::MainTimeline/frame1()

there is something im missing…

here is the tutorial link:

thanks,
stas.