Lingo Dictionary > S > stopEvent |  |

stopEvent

Syntax

    stopEvent

Description

Command; prevents Lingo from passing an event message to subsequent locations in the message hierarchy. Equivalent to the `dontPassEvent` command used in earlier versions of Director, this command also applies to sprite scripts.

Use the `stopEvent` command to stop the message in a primary event handler or a sprite script, thus making the message unavailable for subsequent sprite scripts.

By default, messages are available first to a primary event handler (if one exists) and then to any scripts attached to a sprite involved in the event. If more than one script is attached to the sprite, the message is available to each of the sprite's scripts. If no sprite script responds to the message, the message passes to a cast member script, frame script, and movie script, in that order.

The `stopEvent` command applies only to the current event being handled. It does not affect future events. The `stopEvent` command applies only within primary event handlers, handlers that primary event handlers call, or multiple sprite scripts. It has no effect elsewhere.

Example

This statement shows the `mouseUp` event being stopped in a behavior if the global variable `grandTotal` is equal to 500:

    global grandTotal

    on mouseUp me
    	if grandTotal = 500 then
    		stopEvent
    	end if
    end

Neither subsequent scripts nor other behaviors on the sprite receive the event if it is stopped in this manner.

See also

`pass`