View Full Version : How to "draw" Bitmap OR MovieClip ONTO Shape ??

01-12-2008, 02:05 AM
Let's say I create a new shape:

var shape: Shape = new Shape();

How do I attach my Bitmap or MovieClip to the Shape?

myBitmap = Bitmap(imageLoader.content);

The line: shape.addChild(myBitmap) obviously won't work - what I need is for it to be "DRAWN" as if it was a Shape or part of the Shape.

please help

01-12-2008, 07:40 AM
Basically, use the Shape's graphics property to call drawing methods.

Here is some code:

// I assume here that you already created a Bitmap called myBitmap
// and a MovieClip called myMovieClip, and that you have a Shape
// called myShape.

// Draw a bitmap onto a Shape
myShape.graphics.beginBitmapFill(myBitmap.bitmapDa ta); // There are other parameters you can explore too
myShape.graphics.drawRect(10, 10, 100, 100);

// Draw a MovieClip into a Shape
var myBitmapData:BitmapData = new BitmapData(100, 100);
// At this point, it is basically the same as the bitmap case above
myShape.graphics.drawRect(120, 10, 100, 100);