PDA

View Full Version : Bitmapfilling custom shape



ranjeet_naidu
March 31st, 2009, 06:45 AM
Hi guys am in a bit of a mess here.:hr:
Here is what am trying to do.

createDuplicate function helps me to create a duplicate movieclip. Now I want to bitmap fill this duplicate mc. Is this possible? Am so confused please help...




private function createDuplicate(mc:MovieClip):Sprite
{
var thisBitmapData:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0x00000000);
thisBitmapData.draw(mc);

var thisBitmap:Bitmap = new Bitmap(thisBitmapData);
thisBitmap.smoothing = true;

var newInstance:Sprite = new Sprite();
newInstance.cacheAsBitmap = true;
newInstance.addChild(thisBitmap);

return newInstance;
}
Cheers

ranjeet_naidu
April 1st, 2009, 07:01 AM
anyone???

creatify
April 1st, 2009, 12:45 PM
I don't know of a better way to do this, but there may be a more convenient way. The attached uses your duplication method (note I change stage.stageHeight/width) within your method. But, this duplicates a clip, creates a sprite with a bitmap fill, sets both the duplicate and the sprite cacheAsBitmap = true, then masks the sprite with duplicate. Maybe it helps.