Hi Li:

Thanks for your email:

I need the image centered in a bitmap to save afterwards a file
based on the bitmap, not to display in the screen

How it would be an example with Box?

My code starts from

private function onComplete( event:Event ) :void  {

    var content:DisplayObject = LoaderInfo( event.target ).content;
    var bitmapData:BitmapData = new BitmapData( content.width,
content.height );
    bitmapData.draw( content );
and what I need is this bitmapData ( that contains an image )
to be centered in another bitmap

Thanks
Michael.


On 3/31/08, Michael Wagner <[EMAIL PROTECTED]> wrote:
>
> Hi Alex:
>
> Thanks for your mail
>
> I have tried
>
> 1)
> private function onComplete( event:Event ) :void   {
>
>     var content:DisplayObject = LoaderInfo( event.target ).content;
>     var bitmapData:BitmapData = new BitmapData( content.width,
> content.height );
>     bitmapData.draw( content );
>
>    var img:Image = new Image();
>    img.source = new Bitmap( bitmapData );
>    img.x = 100;
>    img.y = 100;
>
>    var bitmapData2:BitmapData = new BitmapData( 500, 500 );
>    bitmapData2.draw(img,new Matrix());
>
> But it doesn't put the image in the bitmapdata, how it would be
>
>
>
> 2) This second approach
>
>   [Bindable]
> [Embed(source="source1.jpg")]
> public var imgCls:Class;
>
>    var sprite:DisplayObject = new imgCls();
>    sprite.x =35;
>    sprite.y = 200;
>
>   var bitmapData2:BitmapData = new BitmapData(400, 400 );
>  bitmapData2.draw(sprite, new Matrix());
>
>  It puts the image in a bitmap but in position (0.0) instead of (35,200)
>
>
>
> How it would be with mx:Image based on my example ?
>
> Thanks,
>
> Michael.
>
>
>
>
>
>  On 3/30/08, Alex Harui <[EMAIL PROTECTED]> wrote:
> >
> >    Use the mx:Image tag
> >
> >
> >  ------------------------------
> >
> > *From:* [email protected] [mailto:[EMAIL PROTECTED] *On
> > Behalf Of *Michael Wagner
> > *Sent:* Saturday, March 29, 2008 4:34 AM
> > *To:* [email protected]
> > *Subject:* [flexcoders] Image centering
> >
> >
> >
> > Hello:
> >
> >
> >
> > I am new with Flex.
> >
> >
> >
> > I need to position an image ( can be a jpg, bmp, etc ) in a bitmaparea
> > bigger then the image size
> >
> > I have tried codes like this but it is positioned in (0,0)
> >
> >
> >
> > How is the task accomplished ?
> >
> >
> >
> >
> >
> > *area:BitmapData = **new** BitmapData(200,**200**); *
> >
> > var myBitmap:Bitmap = new Bitmap(bitmappicturefrom);
> >
> > myBitmap.x = 100;
> >
> > myBitmap.y = 100;
> >
> > *area.draw(myBitmap);*
> >
> > Thanks,
> >
> > Michael.
> >
> > 
> >
>
>

Reply via email to