Re: [flexcoders] Image centering
You must set position from Matrix. area:BitmapData = *new* BitmapData(200,200); *var* myBitmap:Bitmap = *new* Bitmap(bitmappicturefrom); area.draw(myBitmap,*new* Matrix(1,0,0,1,x,y)); where x,y is position of image.
Re: [flexcoders] Image centering
Thanks a lot for your answers This also worked for me *** var content:DisplayObject = LoaderInfo( event.target ).content; var bitmapData:BitmapData = new BitmapData( content.width, content.height ); bitmapData.draw( content ); var bmp:Bitmap = new Bitmap(bitmapData.clone()); * *var* sprite:Sprite = *new* Sprite(); bmp.x = 200, bmp.y = 50; *var* bitmapData2:BitmapData = *new* BitmapData( 500, 500 ); bitmapData2.draw(sprite,*new* Matrix()); Thanks, Michael. On 4/1/08, Vadim Alekseevski [EMAIL PROTECTED] wrote: You must set position from Matrix. area:BitmapData = *new* BitmapData(200,200); *var* myBitmap:Bitmap = *new* Bitmap(bitmappicturefrom); area.draw(myBitmap,*new* Matrix(1,0,0,1,x,y)); where x,y is position of image.
Re: [flexcoders] Image centering
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:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Michael Wagner *Sent:* Saturday, March 29, 2008 4:34 AM *To:* flexcoders@yahoogroups.com *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.
Re: [flexcoders] Image centering
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:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Michael Wagner *Sent:* Saturday, March 29, 2008 4:34 AM *To:* flexcoders@yahoogroups.com *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.
RE: [flexcoders] Image centering
mx:Image source=source1.jpg horizontalAlign=center verticalAlign=center / No matter how big you make mx:Image, it should center source1.jpg. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Michael Wagner Sent: Sunday, March 30, 2008 11:24 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Image centering 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] mailto:[EMAIL PROTECTED] wrote: Use the mx:Image tag From: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com ] On Behalf Of Michael Wagner Sent: Saturday, March 29, 2008 4:34 AM To: flexcoders@yahoogroups.com mailto:flexcoders@yahoogroups.com 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.
Re: [flexcoders] Image centering
mx:Image verticalAlign=middle horizontalAlign=center verticalCenter=0 horizontalCenter=0 / On Mon, Mar 31, 2008 at 2:03 PM, Alex Harui [EMAIL PROTECTED] wrote: mx:Image source=source1.jpg horizontalAlign=center verticalAlign=center / No matter how big you make mx:Image, it should center source1.jpg. -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Michael Wagner *Sent:* Sunday, March 30, 2008 11:24 PM *To:* flexcoders@yahoogroups.com *Subject:* Re: [flexcoders] Image centering 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:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Michael Wagner *Sent:* Saturday, March 29, 2008 4:34 AM *To:* flexcoders@yahoogroups.com *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.
Re: [flexcoders] Image centering
you can put an image in a Box, and position it's (0,0) in the center of Box, then rotate the Box! -- lwz7512 Ultrapower Flex Team Leader OpenRIA -- A Window You Exploring RIA World http://www.openria.cn - Original Message From: Michael Wagner [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Saturday, March 29, 2008 7:33:59 PM 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(bitmappictur efrom); myBitmap.x = 100; myBitmap.y = 100; area.draw(myBitmap) ; Thanks, Michael. No Cost - Get a month of Blockbuster Total Access now. Sweet deal for Yahoo! users and friends. http://tc.deals.yahoo.com/tc/blockbuster/text1.com
[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.
RE: [flexcoders] Image centering
Use the mx:Image tag From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Michael Wagner Sent: Saturday, March 29, 2008 4:34 AM To: flexcoders@yahoogroups.com 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.