Copying greensock LoaderMax ContentDisplay item

In order to copy a ContentDisplay item and thus be able to use the same bitmap asset multiple times in your application, you need to clone its BitmapData and make a new Bitmap out of it. Like so:


public function getCopyOfAsset(asset:String):Bitmap
{
 // get asset from your LoaderMax queue
 var content:ContentDisplay = myLoaderMax.getContent(asset);

 // access and clone source bitmap's BitmapData
 var bmp:Bitmap = new Bitmap(Bitmap(content.getChildAt(0)).bitmapData.clone());

 return bmp;
}

Kommentare

Beliebte Posts aus diesem Blog

Play M3U8 HTTP Stream through Flash Player using apple-http-osmf

Drawing a line after an arrow that follows a path in a Flash MovieClip

Dropping Clips on Sprite Graphics V2