1. Home
  2. Computing & Technology
  3. Animation

Using System.capabilities to Determine a User's Screen Size

By , About.com Guide

3 of 4

Right-click on the controller clip and select Actions to open the Actions panel. We're going to use an onClipEvent (enterFrame) to check the width and height of the screen as the movie clip cycles through its single frame:
onClipEvent (enterFrame) {
xres = System.capabilities.screenResolutionX;
yres = System.capabilities.screenResolutionY;
}

You'll notice that there are two functions, assigned to two variables: xres and yres. Flash doesn't actually get the resolution as one value, but instead as two separate values. Let's break down how:

System.capabilities.screenResolutionX: This fetches the width value of the user's screen resolution in pixels. This is a static value that you can't affect; you cannot change the user's resolution, but you can change things in your movie based on the resolution by assigning the value to a variable and using it in various scripts.

System.capabilities.screenResolutionY: This fetches the height value of the user's screen resolution in pixels. Again, you can't change the value itself, but you can assign it to a variable to change various things in your movie.

Explore Animation
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. ActionScripting Basics
  6. ActionScripting Basics: Using System.capabilities to Determine a User's Screen Size

©2009 About.com, a part of The New York Times Company.

All rights reserved.