Create a BitmapData from an asset embedded inside an SWF
The goal of this snippet is to create a BitmapData from an assets (for example a MovieClip) stored inside an SWF library created using Flash and loaded through CSS;
//CSS FILE
.myComponentStylName {
backgroundImage : Embed(source="library.swf", symbol="MyMovieClip");
}
//ActionScript Code
var BackgroundImage:Class = getStyle("backgroundImage");
var backgroundImageAsset:SpriteAsset = SpriteAsset(new BackgroundImage());
var bitmapData = new BitmapData(backgroundImageAsset.width, backgroundImageAsset.height);
var matrix:Matrix = new Matrix();
bitmapData.draw(ImageSnapshot.captureBitmapData(backgroundImageAsset),matrix);




