ByteArray to BitmapData

The Below code demonstrates the conversion of ByteArray to BitmapData. In the below case, SWF is loaded and converted into BitmapData

private function swfLoad_complete(evt:Event):void {
private function byteArrayToBitmapData(ba:ByteArray):void {
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, getBitmapData);
private function getBitmapData(e:Event):void {
var content:* = loader.content;
var BMPData:BitmapData = new BitmapData(content.width,content.height);
var UIMatrix:Matrix = new Matrix();
BMPData.draw(content, UIMatrix);

    • david
    • April 8th, 2009

    can you help to decompile an swf file?

  1. The “loader.loadBytes” was very helpful. Did not think of that function.


    • Ganga
    • December 4th, 2009

    Is it possible to load .tif images.. If so How can I achieve to load tif images?

    • avejidah
    • January 14th, 2010

    How about the other way around? BitmapData to ByteArray? I tried getPixels… but the bytearray is empty.

    • avejidah
    • January 14th, 2010

    Nm, figured it out.

    var rec:Rectangle = new Rectangle(0, 0, imgWidth, imgHeight);
    var ba:ByteArray = bmpData.getPixels(rec);

    • Gesse Goncalves
    • June 6th, 2010


    for help
    from Brasil

    • Amritha Prem
    • December 4th, 2014

    I’m not able to load bmp image into loader class. is there any other way?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: