PDA

View Full Version : Scale MC before using the Draw() method??


largo
08-25-2008, 09:55 PM
Hi, I have an application that turns an MC into a bitmap and then saves the bitmap into a LSO as a ByteArray. I've got that part working, but now I want to change the scale or dimensions of the MC or bitmap before it is saved. Is there anyway of doing this, because the problem I ran into is that after you've changed the scale or dimensions of an MC, the Draw() method still saves the dimensions or scale, of the inside of the MC. The question is:
Is it possible to save a smaller scale image of the MC using Draw()?

I hope I'm making sense.... can anyone help me?:confused:

vcovcf
08-26-2008, 12:34 AM
it works if you take your movieclip, scale it, add it to a container sprite or movieclip, and then copy the container with bitmapdata. try this example out....





var s:Sprite = new Sprite();
var holder:Bitmap = new Bitmap();
var map:Bmap = new Bmap(NaN, NaN);
holder.bitmapData = map;
s.addChild(holder);
s.scaleX = .3;
s.scaleY = .3;

var container:Sprite = new Sprite();
container.addChild(s);
addChild(container);

var s2:Sprite = new Sprite();
var bmd:BitmapData = new BitmapData(s.width, s.height);
var b:Bitmap = new Bitmap(bmd);
bmd.draw(container);
s2.addChild(b);
addChild(s2);