# ArgumentError: Error #2015: Invalid BitmapData

**URL:** https://forum.kirupa.com/t/argumenterror-error-2015-invalid-bitmapdata/316248
**Category:** Uncategorized
**Created:** [November 16, 2010, 9:50pm UTC](https://forum.kirupa.com/t/argumenterror-error-2015-invalid-bitmapdata/316248 "2010-11-16T21:50:24Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jik\_ff](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@jik\_ff](https://forum.kirupa.com/u/jik_ff)
#### Post date: [November 16, 2010, 9:50pm UTC](https://forum.kirupa.com/t/argumenterror-error-2015-invalid-bitmapdata/316248/1 "2010-11-16T21:50:24Z")

</div>

I’m trying to load in a sample jpg to a custom class MC. I found this string of code on line, but I’m getting the 2015 error. Here’s were things are going wrong:

```auto
   var imageURLRequest:URLRequest = new URLRequest("sample.jpg"); 
   var myImageLoader:Loader = new Loader(); 
   myImageLoader.load(imageURLRequest); 
   
   myImageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded); 
   function imageLoaded(e:Event):void { 
    var myBitmapData:BitmapData = new BitmapData(myImageLoader.width, myImageLoader.height); 
    myBitmapData.draw(myImageLoader); 
    var myBitmap:Bitmap = new Bitmap; 
    myBitmap.bitmapData = myBitmapData; 
    addChild(myBitmap); 
   } 

```

I have the sample.jpg in the same folder as the project files. Thanks in advance.
