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 <[email protected]> wrote:
From: ganaraj p r <[email protected]>
Subject: [flexcoders] Centering a Scaled Image ( Bug ? ) [1 Attachment]
To: [email protected], [email protected]
Date: Monday, November 30, 2009, 4:08 PM
[Attachment(s) from ganaraj p r included below]
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" 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
Attachment(s) from ganaraj p r
1 of 1 File(s)
sampletest.zip
Reply to sender
|
Reply to group
Messages in this topic
(1)
Recent Activity:
New Members
25
Visit Your Group
Start a New Topic
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location:
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
MARKETPLACE
Going Green: Your Yahoo! Groups resource for green living
Mom Power: Discover the community of moms doing more
for their families, for the world and for each other
Switch to: Text-Only, Daily Digest • Unsubscribe • Terms of Use
.
__,_._,try this-___