Thanks,
var loader:Loader = Loader(event.target.loader);
var image:Bitmap = Bitmap(loader.content);
var bitmapHolder:UIComponent = new UIComponent();
var mySprite:Sprite = new Sprite();
mySprite.addChild(image);
bitmapHolder.addChild(mySprite);
canvas.height = image.height;
canvas.width = image.width;
canvas.addChild(loader);
canvas.graphics.lineStyle(2, 0xff0000, 1);
canvas.graphics.moveTo(-100, -100);
canvas.graphics.lineTo(200, 200);
This works nicely, and means you can use your drawable component to
draw over anything aswell.
There is a sample application and sample code on my blog:
http://www.munkiihouse.com/?p=4
Hope that helps
Tony
Wow! What a simple and useful tool. Any idea about how to save that
drawing as an image or swf with the click of a button. I am working
on a social network and would like to allow users to draw a logo for
themselves. I would like to add flash like drawing and text
features. With the powerful actionscript 3 classes, I bet this
wouldn't be terribly difficult. Can someone try to implement these
features?
In Flex2 this is a little more complicated. You have to create a
BitmapData class, and then call draw function on the bitmap data
object to get an image of the control. From there you can turn it
into an image or save it out to a server etc