Flex : Translate Embed Image into BitmapData

actionscript-3apache-flex

  • I am looking for good, and hopefully for fast methood to turn an Embed Image into BitmapData.

Best Answer

If you embedded the image you could use the reference to Bitmap.bitmapdata.

package
{
    import flash.display.Bitmap;
    import flash.display.Sprite;

    public class Main extends Sprite
    {

        [Embed(source="assets/image.png")]
        private var embeddedImage : Class;


        public function Main()
        {
            var image : Bitmap = new embeddedImage();
            //addChild(image);

            // reference
            var bitmapData : BitmapData = image.bitmapData.clone();
        }
    }
}
Related Topic