PDA

View Full Version : How to get screen resolution every time user change


Raji.S
09-18-2009, 12:34 PM
Hi,

I am new to flex. In my application, I set my canvas width as screen Resolution. Like this,

<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
width="{Capabilities.screenResolutionX}"
height="1000"
showEffect="Fade"
hideEffect="{Application.application.FadeOut}"
horizontalScrollPolicy="off"
xmlns:remotedevelopment="components.remotedevelopment.*"
xmlns:insoft="components.*"
backgroundColor="0xFFFFFF">


Its working well. My problem is, after ran my application, the user will change the resolution. That time, automatically the width also should change as a screen resolution . wt i should do for this?. pls help me.
Thanks in advance

wvxvw
09-18-2009, 02:56 PM
Assign the new value to the width property of the canvas in response to user's request. No windows application, afaik, doesn't resize itself automatically after screen resolution changes, so does Flash / AIR. I have no idea why would you like to do that automatically... this will rather frighten the user...

Raji.S
09-24-2009, 10:21 AM
I got the solution. In resize event, i changed my canvas height to stageheight likewise width. so it works well.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" resize="resized()" applicationComplete="resized()">

private function resized():void{homepage.width = stage.stageWidth;
homepage.height = stage.stageHeight;}