The code below will display the size of the current device screen that the SWF is run on. This also works as an AIR application. In order for this code to work, you will need to create a text field on the stage with the instance name of 'sizeTxt'. Also make sure the Text field is set to 'Dynamic Text'. Insert the code below on frame 1 of the flash project's timeline.
1 | |
2 | import flash.system.Capabilities; |
3 | |
4 | var screenWidth:Number = Capabilities.screenResolutionX; |
5 | var screenHeight:Number = Capabilities.screenResolutionY; |
6 | |
7 | sizeTxt.text = ("sw2:"+screenWidth+" sH2:"+screenHeight); |