Load embed image in Loader

Posted on 2008-11-17
Last Modified: 2013-11-11
How can I load embed image (jpg,gif,png, bmp) in a Loader?
I tried with the code in attach but it doesn't work?


private var bmp:Class;


private function LoadURL():void


	var myBitmap:BitmapData = new bmp().bitmapData;

	var pixels:ByteArray = myBitmap.getPixels( new Rectangle(0,0,myBitmap.width,myBitmap.height) );




Open in new window

Question by:rfedericoni
    LVL 39

    Expert Comment

    don't know if this post from the friends at kirupa helps
    i havent gone beyond hello world in flex yet (no time!!)
    LVL 19

    Accepted Solution

    private var bmp:Class;

                            var asset:BitmapAsset = new bmp() as BitmapAsset;

                            var ba:ByteArray = new ByteArray();
                            ba.writeBytes( new JPEGEncoder().encode(asset.bitmapData));
                            var l:Loader = new Loader();
                            l.loadBytes( ba);

    Author Comment

    It's slow to load but it works..

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
    I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
    The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
    This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now