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:
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.