?
Solved

Load embed image in Loader

Posted on 2008-11-17
3
Medium Priority
?
2,956 Views
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?
[Bindable]
[Embed(source="../images/MB1.png")]
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) );
           
        loader.loadBytes(pixels);
}

Open in new window

0
Comment
Question by:rfedericoni
3 Comments
 
LVL 39

Expert Comment

by:blue-genie
ID: 22983682
don't know if this post from the friends at kirupa helps

http://www.kirupa.com/forum/showthread.php?p=2390556
i havent gone beyond hello world in flex yet (no time!!)
0
 
LVL 19

Accepted Solution

by:
Gary Benade earned 750 total points
ID: 22992484
[Bindable]
[Embed(source="../images/MB1.png")]
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);
0
 

Author Comment

by:rfedericoni
ID: 22992629
It's slow to load but it works..
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
Suggested Courses

809 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