I am using BitmapAssets to add to a sprite which is printed using
PrintJob.
[Embed(source="images/logo.png")]
[Bindable]
public var logo:Class;
...
var bitmapImg:BitmapAsset = new logo() as BitmapAsset;
bitmapImg.smoothing = true;
bitmapImg.setActualSize(500, 42);
sheet.addChild(bitmapImg);
This works fine when the image to be added is embedded. Some images I
need to add dynamically. How would I do this?
I've tried using a Loader and doing something like this:
var imgLdr:Loader = new Loader(imgURLReq);
imgLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, imgLoaded);
function imgLoaded(e:Event):void{
var eventImg:BitmapAsset = new BitmapAsset;
eventImg.bitmapData = imgLdr.content as BitmapData
eventImg.smoothing = true;
eventImg.setActualSize(300, 200);
sheet.addChild(eventImg);
}
I think I need to do something similar to the static method by loading
the image with a Loader and casting it as a Class, but this is not
working out for me.
Any ideas?
Thanks!
Jayson