header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
sachin
Points:0
Posts:0

5/29/2010 12:09:00 PM

Title: How can I detect the user's screen resoultion in AS3 to make my stage and its contents the same size


Hi,

I want to detect the user's screen resolution in AS3 so that I can make my stage and its contents the same size dynamically?

Thank you,
Sachin




1
Rex
Points: 1180
Posts:0
5/29/2010 11:15:30 PM



you can attach resize listener to stage. which will inform your flex application when the stage is resized.

first you need to set the height and width to 100% in the html for flash movie.

then use the following code inside flex.

//call this function on applicationComplete
private function setScaleMode():void{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT; 
stage.addEventListener(Event.RESIZE, resizeEventHandler);
}

function resizeEventHandler(evt:Event) {
    trace("Changed Width: "+stage.stageWidth);
    trace("Changed Height: "+stage.stageHeight); 
}


2
Juan
Points: 0
Posts:0
5/29/2010 11:29:25 PM



you can also zoom your swf according to the changed browser resolution, for that you can set the height/width to 100% in the embed and object tags of flash.

Set the scalemode property to showall, this will make your swf movie zoom inand out with cahnge in resolution/ screeen or browser size

stage.scaleMode= StageScaleMode.SHOW_ALL;

3
Venkatesan
Points: 0
Posts:0
5/31/2010 9:54:20 PM



One can also find the screen resolution using Capabilities class..

Capabilities.screenResolutionX and Capabilities.screenResolutionY gives the resolution!!


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 2+3 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions