Articles Archive
Articles Search
Director Wiki

Dynamically Resizing a Projector

February 5, 2001
by Will Turnage

Dear Multimedia Handyman:

How do I change my projector size to automatically resize itself to match the user's screen size?

Loh Dexter


Resizing your projector to match the user's screen is fairly simple to do, and makes use of just a few Lingo terms: the desktopRectList, the stage, rect, and drawRect.

The first term you should familiarize yourself with is the desktopRectList. This is a Lingo read-only property that tells you how many monitors are set up on the computer as well as the dimensions of each monitor. Each monitor is a separate entry in the list, and the size and the position of each monitor is given as a rect. For instance,

put the desktopRectList
-- [rect(0, 0, 1024, 768)]

In this example, there is only one item in the list, so that means the user only has one monitor. The dimensions of the lone item in the rect show that the user's monitor has a resolution of 1024x768. If a user has two monitors on his or her computer, then the desktopRectList looks something like this:

put the desktopRectList
-- [rect (0, 0, 1024, 768), rect (1025, 0, 1825, 600)

Notice that the second monitor in the list has a rect that doesn't start with point (0, 0). This is so you can tell the location of the second monitor in relation to the first monitor. In this example, you can tell that the user has two monitors, one running at 1024x768, and the other just to the right of the first running at 800x600 (aligned at the top edge).

So now that you know how large your user's monitor is. The rest should be pretty simple, right? Almost. To resize the stage, all you need to do is add a single line of code to your prepareMovie handler:

on prepareMovie

  (the stage).rect = (the desktopRectList)[1]


There's only one problem with this approach. When you change the rect of the stage, it just resizes the Stage window to fill the screen, it doesn't rescale the sprites to fill the window. So, if my movie is 640x480, and my monitor is 1024x768, then this code just places my movie in the upper left corner of the screen and fills the rest of the window with the stage color. To make matters worse, any off-screen elements within the 1024x768 range will now show up on the screen where they wouldn't have before.

If you want to have your movie scale itself to fill the user's screen, then you need to set the drawRect of the stage as well. The drawRect is a Lingo rect that determines how a movie's contents get drawn within the window. If you had a movie whose rect was 640x480, but whose drawRect was rect (0, 0, 320, 240), then your movie would be scaled to fill the upper quarter of your window.

To scale your projector to fill the entire screen, then you have to set the movie's drawRect to equal the user's desktop size. The solution is just two lines of code that fit in your prepareMovie handler:

on prepareMovie

  (the stage).rect = (the desktopRectList)[1]
  (the stage).drawRect = (the desktopRectList)[1]


Will Turnage is a multimedia programmer based in New York City. In addition to his weekly role as Director Online's Multimedia Handyman, he is also the Technology Director for Sony Music's Client Side Technologies Group. You can read more about his work at

Copyright 1997-2019, Director Online. Article content copyright by respective authors.