Lingo Dictionary > T-Z > tell |  |

tell

Syntax

    tell whichWindow to statement(s)
    tell whichWindow
    	statement(s)
    end

Description

Command; communicates statements to the window specified by `whichWindow`.

The `tell` command is useful for allowing movies to interact. It can be used within a main movie to send a message to a movie playing in a window, or to send a message from a movie playing in a window to the main movie. For example, the `tell` command can let a button in a control panel call a handler in a movie playing in a window. The movie playing in a window may react to the first movie handler by executing the handler. The movie playing in the window may interact with the main movie by sending a value back to the movie.

When you use the `tell` command to send a message to a movie playing in a window, identify the window object by using the full pathname or its number in `windowList`. If you use `windowList`, use the expression `getAt(the windowList`, `windowNum``)`, where `windowNum` is a variable that contains the number of the window's position in the list. Because the opening and closing of windows may change the order of `windowList`, it is a good idea to store the full pathname as a global variable when referencing windows with `getAt` in `windowList`.

Example

A multiple-line `tell` command resembles a handler and requires an `end tell` statement:

    global childMovie

    tell window childMovie
    	go to frame "Intro"
    	the stageColor = 100
    	sprite(4).member = member "Diana Ross"
    	updateStage
    end tell

Example

When a message calls a handler, a value returned from the handler can be found in the global `result` property after the called handler is done. These statements send the `childMovie` window the message `calcBalance` and then return the result:

    global childMovie

    tell window childMovie to calcBalance
    -- a handler name
    myBalance = result()
    -- return value from calcBalance handler

Example

When you use the `tell` command to send a message from a movie playing in a window to the main movie, use the `stage` system property as the object name:

    tell the stage to go frame "Main Menu"

When you use the `tell` command to call a handler in another movie, make sure that you do not have a handler by the same name in the same script in the local movie. If you do, the local script will be called. This restriction applies only to handlers in the same script in which you are using the `tell` command.

Example

This statement causes the Control Panel window to instruct the Simulation movie to branch to another frame:

    tell window "Simulation" to go frame "Save"