All examples
Setting resolution in multiple movies
| Downloads |
DisplayModeExample_1.zip
- Description:
- Associated source files
- Size:
- 86 kB
- Requirements:
- Director MX
DisplayMode Xtra
|
In case of presentations consisting of many .dir files (invoked by
play movie function) you should not
use
Default and
DirectX options of DisplayMode Xtra for it leads to unwanted
resolution switching while switching to other movie (.dir file) - a short flash appears on the screen then.
WinAPI value should be applied in such cases.
You should not also use autorestoring when exiting a movie (the
AutoRestore option)
for it leads to resolution switching as well.
It should be assumed that resolution can be set automatically in the first movie (the .dir
file used to start the projector), but restoring resolution must be done with
RestoreDisplayMode
Lingo function in every place in which you can close the presentation and return to
the system.
We will show how to do this. We will create a simple presentation consisting of three .dir
files. The first will be used to start the projector while the other two will be invoked during
the presentation. It will be possible to navigate between movies with some simple text buttons and
to quit the presentation from any of the movies, either by clicking "Close" or by pressing "Escape" or Alt+F4 combination.
We start by creating a file with name Movie01.dir. We set 640 x 480 resolution. We put on the stage
a text indicating that that is the movie no 1. We create global script (Movie type)
and we add to it the following content:
on prepareMovie
the centerStage = true
the exitLock = true
the keyDownScript = "gKeyDown()"
end
on gKeyDown
if (the keyCode = 118) and (the optionDown) then
-- Alt + F4
gExit()
end if
if (the keyCode = 53) then
-- Escape
gExit()
end if
end
on gExit
quit
end
Comments on the above script:
the centerStage = true allows to center the Stage on the screen,
the exitLock = true blocks the default work
of the Escape button (quit the presentation), while
the keyDownScript = "gKeyDown()" causes that every press
of any key is intercepted by gKeyDown function. In this function we check if Alt+F4
or Esc has been pressed and if so, we invoke "gExit" function. At the moment that function just quits the presentation.
We add 2 text buttons which invoke Movie02.dir and Movie03.dir respectively.
E.g. behavior attached to Movie02 button in the simplest case can have a form:
on mouseUp me
play movie "Movie02.dir"
end
We add "Exit" text button with behavior attached:
on mouseUp me
gExit()
end
We create Movie02.dir and Movie03.dir in the same way assuming that from Movie02.dir you can
switch to Movie01.dir and Movie03.dir, while from Movie03.dir - to Movie01.dir and Movie02.dir.
We create a projector from Movie01.dir and start it. We check correctness of evoking
every movies and of quitting the presentation. It is high time to add setting resolution with DisplayMode Xtra.
We add DisplayMode Xtra to Movie01.dir file. We assume the following option settings in the dialog window:
- Display mode: 640 x 480 x 32 x 0 (refresh rate default)
- AutoSet: On
- AutoRestore: Off
- Alternative modes: not used
- Method: WinAPI
With these settings at the start of a movie 640 x 480 resolution will be automatically set with Windows API. When quitting
a presentation original resolution must be restored - with the
RestoreDisplayMode function of DisplayMode Xtra. In
our example we add invoking this function to the global "gExit" function responsible for quitting the presentation. So:
on gExit
member("DisplayMode1").RestoreDisplayMode()
quit
end
Similarly we add DisplayMode Xtra to Movie02.dir and Movie03.dir with one exception: the
AutoSet
option must be disabled for at the time of invoking those movies resolution will be already set by Movie01.
However, since from those movies it should be possible to quit the presentation, we must also add
member("DisplayMode1"). RestoreDisplayMode()
instruction to the "gExit" function, in the same way as in the Movie01.dir.
Once again we create a projector from Movie01.dir and start it. At the start of the projector
640 x 480 resolution is set. Switching between movies does not cause any flashes. Quitting the projector in any way does restore the original resolution.
Any comments? -
All examples