Thanks for tip, Darron,
so now it's not possible to have images compiled in application's SWF or
have them in external SWF to be loaded dinamicly? I think such feature would
be helpful for game developers that do not need Flex Framework API.

Tomas Lehuta
[http://lharp.net]


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Darron J.
Schall
Sent: Monday, November 14, 2005 2:23 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] AS3: How to get BitmapData from embeded image

Tomas Lehuta wrote:
> No no, Darron,
> I'd like to extract image's BitmapData to be able to manipulate it.
> So prior to displaying it via addChild() I need to do some 
> transformations and image distortion..
> Is it possible with new API?
Ah, sorry - that's what I get for not fully reading the question before
answering :-)

I believe right now the Embed meta data is mainly intended for Flex skinning
purposes (hence the SkinSprite when you create a new instance)
- I think if you want to get the bitmap data of an image you need to load it
in at runtime, something like this:

package {
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
   
    public class Example extends Sprite {
       
        private var bitmap:Bitmap;
       
        public function Example() {
            var loader:Loader = new Loader();
            loader.addEventListener( EventType.COMPLETE, loadComplete );
            loader.load( new URLRequest( "example.jpg" ) );   
        }
       
        public function loadComplete( event:Event ):Bitmap {
            var loader:Loader = Loader( event.target );
            bitmap = Bitmap(loader.content);
            // manipulate bitmapdata here:
            bitmap.bitmapData.setPixel( 0, 0, 0xFFFFFF );
            addChild( bitmap );
        }
    }
}


I wouldn't be surprised if there was an easier way..  but it might have to
wait until Flash authoring has support for AS3.

-d

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to