# Detecting screen size - not working in my mobile device

**URL:** <https://forum.kirupa.com/t/detecting-screen-size-not-working-in-my-mobile-device/254440>\
**Category:** flash\
**Created:** [March 12, 2008, 6:23am UTC](https://forum.kirupa.com/t/detecting-screen-size-not-working-in-my-mobile-device/254440 "2008-03-12T06:23:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chethan](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@chethan](https://forum.kirupa.com/u/chethan)\
**Post date:** [March 12, 2008, 6:23am UTC](https://forum.kirupa.com/t/detecting-screen-size-not-working-in-my-mobile-device/254440/1 "2008-03-12T06:23:38Z")

</div>

Hello Guys,

Actually I got the below code from net to detect the portrait and landscape screen. When I checked the same in mobile device it didn’t work properly. I am using O2 Autom device.

Can you please let me know why is it so…!!! or Do I need to add anything more…?

**Code:**

stop();

fscommand2(“FullScreen”, true);

/\* Set scaleMode to “noScale” setting: the SWF will not be scaled  
when the size of the screen device changes\*/  
Stage.scaleMode = “noScale”;

//Set the current alignment of the Flash movie to “Top Left”  
Stage.align = “TL”;

// Create a new movie Clip  
this.createEmptyMovieClip(“container”,this.getNextHighestDepth());  
container.\_x = 0;  
container.\_y = 0;

//Detect the screen size and load the correct file  
if (Stage.width == 240) {  
container.loadMovie(“myApp\_portrait.swf”);  
} else {  
container.loadMovie(“myApp\_landscape.swf”);  
}
