Reputation: 2693
I need to add "_myThumb" to 4 container MovieClips. The problem is that it's only working for 1 MovieClip. What do I need to change?
var _myThumb:Bitmap;
var _myThumbData:BitmapData;
function createThumbs()
{
_myThumbData = new BitmapData(photodefault.width,photodefault.height,false,0xffffff);
_myThumb = new Bitmap(_myThumbData);
_myThumb.smoothing = true;
_myThumb.scaleX = _myThumb.scaleY = 0.2;
// Add to t1-t4 container
photothumbs.t1.addChild(_myThumb);
photothumbs.t2.addChild(_myThumb);
photothumbs.t3.addChild(_myThumb);
photothumbs.t4.addChild(_myThumb);
}
createThumbs();
function createThumbnail()
{
_myThumbData.draw(photodefault);
}
Thanks. Uli
Upvotes: 0
Views: 5022
Reputation: 15560
You need to create separate Bitmap objects for each thumb, but you can use the same source Bitmapdata for that. This is an example using a utility function to create the bitmap object:
function createThumbs()
{
_myThumbData = new BitmapData(photodefault.width,photodefault.height,false,0xffffff);
// Add to t1-t4 container
photothumbs.t1.addChild(createBitmap(_myThumbData));
photothumbs.t2.addChild(createBitmap(_myThumbData));
photothumbs.t3.addChild(createBitmap(_myThumbData));
photothumbs.t4.addChild(createBitmap(_myThumbData));
}
function createBitmap(bmd:BitmapData):Bitmap
{
var bitmap:Bitmap = new Bitmap(bmd);
bitmap.smoothing = true;
bitmap.scaleX = bitmap.scaleY = 0.2;
return bitmap;
}
Upvotes: 3