Return to Snippet

Revision: 58693
at July 29, 2012 09:42 by burakkirkil


Initial Code
//Hopefully, you can bypass this limitation by creating a BitmapData by yourself, draw the MovieClip on it, and pass it to multipe Bitmap instances. So let's take a simple example, in the folllowing movie, when you click on the "cacheAsBitmap" button, I create multiple instances of an Apple MovieClip, set cacheAsBitmap, and move them on screen :

var apple:Apple;

for (var i:int = 0; i< 100; i++)
{
apple = new Apple();
 
apple.cacheAsBitmap = true;
 
addChild ( apple );
}
//When you click on the "draw" button, I first create an instance of the apple MovieClip, draw it on a BitmapData and then create Bitmap instances linked to the one and unique BitmapData instance :

var source:AppleSource = new AppleSource();
 
var buffer:BitmapData = new BitmapData ( source.width, source.height, true );
 
buffer.draw ( source );
 
var bitmapApple:BitmapApple;
 
for (var i:int = 0; i< 100; i++ )
{
bitmapApple = new BitmapApple( buffer );
 
addChild ( bitmapApple );
}

Initial URL


Initial Description
Manual Rasterize

Initial Title
Manual Rasterize

Initial Tags


Initial Language
ActionScript 3