I am trying to simply load an external .jpg, and I am simply not getting it.
I am using Flash CS3.
The following code was shamelessly lifted from Actionscript 3.0 Cookbook, and I removed the package and class info.
The image “img1.JPG” is found in the same folder as the .fla file.
Each time I run the program, I just get a white screen.
Where I am going wrong?
TIA for an answer. --4hov13
import flash.display.Sprite;
import flash.display.Loader;
import flash.events.Event;
import flash.net.URLRequest;
// page 204 ascb
var _loader:Loader = new Loader();
function BitmapLoader() {
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
_loader.load(new URLRequest("img1.JPG"));
}
function onComplete(event:Event):void {
var image:Bitmap = Bitmap(_loader.content);
var bitmap:BitmapData = image.bitmapData;
addChild(image);
}