Free technical help for digital creators - music, video, art, photography, graphic & web design

MIAWs (Director movies in a window) by Ian Wood & Matt Ottewill

Example Director movies

download icon Download tutorial MIAW
folder/movies.
(Zip 44Kb)

Introduction

Director can have multiple windows (each containing an individual movie) open simultaneously. Using lingo you can specify the type of window, size and location.

In general you will have a first movie (perhaps your menu) from which you will open additional windows.

To open a MIAW

This script opens a .dir movie file (mymiaw.dir) in a new window ...

on mouseEnter
cursor 280
end mouseEnter
------------------------------------
on mouseUp
whichWindow = "mymiaw"
window().new(whichWindow)
window(whichWindow).open()
end mouseUp
------------------------------------
on mouseLeave
cursor 0
end mouseLeave

NOTE: In this example "mymiaw" is the name of the movie you want to open in the new window.

To close a MIAW

There are 2 ways of doing this ...

  1. close window

  2. forget window

1. Close window

When you Close a window/MIAW, the movie becomes "invisible" but continues running in the background, keeping variables etc active.

The following script can be placed on a button ...

on mouseEnter
cursor 280
end mouseEnter
------------------------------------
on mouseUp
whichWindow = "mymiaw"
window(whichWindow).close()
end mouseUp

------------------------------------
on mouseLeave
cursor 0
end mouseLeave

2. Forget window

When you forget a window/MIAW, the movie it is purged from RAM and all local variables etc are cleared.

The following script can be placed on a button ...

on mouseEnter
cursor 280
end mouseEnter
------------------------------------
on mouseUp
whichWindow = "mymiaw"
window(whichWindow).forget()
end mouseUp
------------------------------------
on mouseLeave
cursor 0
end mouseLeave

Window types

Director 8 and 9 allowed preset Window Types to be selected for a window. these would define the type of window and its appearance. Director 10 (MX) allows finer control of window appearance using the Display Template tab in the Property Inspector.

1. With a movie open in the Stage, select Window > Property inspector.
2. Click the Display Template tab. A list of MIAW properties appears.
3. Set the General properties:
4. Set the Title bar options.
5. Set the Appearance options.

You can also use Lingo to define window attributes (properties). appearanceOptions and titleBarOptions are both useful.

Problem fix for when MIAW stops sound playback:

In authoring and projectors, opening or forgetting a MIAW stops the puppetsound and sound playfile sounds in all movies.

Fixes for channels 1& 2

Using the forget window command stops the sound. Use close window instead.

Fixes for channels 3-8

forget window AND open window stops the sound. The fix is to open the MIAW before playing the sound, using visibility or rect to control when it shows. Then use close window, not forget window.

Here is an example script for opening the Miaw ...

on mouseEnter
cursor 280
end mouseEnter
------------------------------------
on mouseup
whichWindow = "mymiaw"
window().new(whichWindow)
window(whichWindow).open()
whichWindow.movetofront()
end mouseup
------------------------------------
on mouseLeave
cursor 0
end mouseLeave

And for closing the MIAW ...

on mouseEnter
cursor 280
end mouseEnter
------------------------------------
on mouseUp
whichWindow = "mymiaw"
window(whichWindow).close()
end mouseUp

------------------------------------
on mouseLeave
cursor 0
end mouseLeave

Controlling window size and position

MIAW window/stage size and position can be controlled with the rect() property. This Lingo property defines the coordinates (relative to the screen/monitor) that determine the dimensions of a MIAW.

The coordinates are given in order as ...

left, top, right, and bottom

or in Lingo ...

rect(100, 100, 400, 400)

These coordinates define a MIAW as having its ...

  • left edge 100 pixels from the left side of the screen

  • top edge 100 pixels from the top side of the screen

  • right edge 400 pixels from the right side of the screen

  • bottom edge 400 pixels from the bottom side of the screen

The window would therefore be 300 x 300 pixels in size

Here is an example script ...

on mouseEnter
cursor 280
end mouseEnter
------------------------------------
on mouseUp
whichWindow = "mymiaw"
window().new(whichWindow)

window (whichWindow).rect = rect(100, 100, 400, 400)
window(whichWindow).open()
end
mouseup
------------------------------------
on mouseLeave
cursor 0
end mouseLeave

Cropping a movie

If you choose values for the right and bottom coordinate/positions which are too low, your MIAW will be cropped.

Covering the 1st movie with a MIAW

If you wanted your MIAW to cover the stage of the movie you are opening it from try ...

on mouseEnter
cursor 280
end mouseEnter
------------------------------------
on mouseUp
whichWindow = "mymiaw"
window().new(whichWindow)
window(whichWindow).rect = rect(the stageLeft, the stageTop, the stageRight, the stageBottom)
window(whichWindow).open()

end
mouseup
------------------------------------
on mouseLeave
cursor 0
end mouseLeave

Director will use the stageLeft, the stageTop, the stageRight, the stageBottom properties of the first movie to size and position your MIAW.

If you resize the stage of your first movie, the MIAW stage will resize with it.

Scaling a movie

As well as controlling the size of your MIAW window, you can scale the size of the movie that appears in it using the drawRect property.

In this example the MIAW movie has a original stage size of 320 by 240 which is being scaled x 2 by the drawRect property..

on mouseEnter
cursor 280
end mouseEnter
------------------------------------
on mouseup
whichWindow = "mymiaw"
window().new(whichWindow)


window(whichWindow).drawRect = rect(0, 0, 200, 180)

window(whichWindow).open()
end mouseup
------------------------------------
on mouseLeave
cursor 0
end mouseLeave

In this example the MIAW movie is magnified but its window is not, so the bottom and right of the stage is not visible.

The following script scales the movie AND increases the window size so it is visible.

on mouseEnter
cursor 280
end mouseEnter
------------------------------------
on mouseup
whichWindow = "mymiaw"
window().new(whichWindow)

window(whichWindow).rect = rect(the stageLeft, the stageTop, the stageRight, the stageBottom)

window (whichWindow).drawRect = rect(0, 0, 200, 180)

window(whichWindow).open()
end mouseup
------------------------------------
on mouseLeave
cursor 0
end mouseLeave

WARNING 1: Increasing the size of a MIAW can lead to performance problems.

WARNING 2: Field and text members (fonts) will NOT be resized.