Hi, Thanks. Yes. But that is a workaround right?
I wanted to know if this was a bug with flex! Or if there was an mxml way of doing it. On Mon, Nov 30, 2009 at 5:42 PM, Manoj Kumar <manoj_kode...@yahoo.com>wrote: > > > try this mt- > > private function onAppComplete():void > { > stage.addEventListener(Event.RESIZE,onResize); > _spr.x = (stage.stageWidth - _spr.width)/2; > _spr.y = (stage.stageHeight - _spr.height)/2; > _ui.width = stage.stageWidth; > _ui.height = stage.stageHeight; > } > private function onResize(evt:Event):void > { > _spr.x = (stage.stageWidth - _spr.width)/2; > _spr.y = (stage.stageHeight - _spr.height)/2; > _ui.width = stage.stageWidth; > _ui.height = stage.stageHeight; > } > > > > --- On *Mon, 11/30/09, ganaraj p r <ganara...@gmail.com>* wrote: > > > From: ganaraj p r <ganara...@gmail.com> > Subject: [flexcoders] Centering a Scaled Image ( Bug ? ) [1 Attachment] > To: flex_in...@googlegroups.com, flexcoders@yahoogroups.com > Date: Monday, November 30, 2009, 4:08 PM > > > > > I was wondering if this was a bug with flex or if I was doing something > totally wrong. > > The amount of code in this is extremely low, so , I was guessing that there > was nothing wrong from my part. > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe. com/2006/ > mxml<http://www.adobe.com/2006/mxml>" > layout="absolute"> > <mx:Image id="myimage" maintainAspectRatio ="true" > horizontalCenter="0" verticalCenter="0" > source="@Embed(source='images.jpg')" > scaleContent="true" width="100%" height="100%"/> > </mx:Application> > > > This is all the code there is in this application ( I am attaching the app, > for your reference ) . > My expectation from this code is that the image should fit the screen, > maintain the aspect ratio of the image and finally be both centered > horizontally and vertically! > > > Can someone help me out in this ? > > -- > Regards, > Ganaraj P R > > > > -- Regards, Ganaraj P R