Reputation: 2604
Upvotes: 1
Views: 6252
Reputation: 425
just like this.
var imgBitmap:BitmapAsset = new EmbedImage();
var bitmapData:BitmapData = imgBitmap.bitmapData;
(or)
var bmd1:BitmapData = new EmbedImage().bitmapData;
Upvotes: 1
Reputation: 9897
Is your embedded image raster or vector? Raster becomes BitmapAsset
, just instantiate and get bitmapData from it. If vector movieclip, instantiate it, then render with BitmapData.draw
.
Upvotes: 2
Reputation: 3907
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();
}
}
}
Upvotes: 4