Lingo Dictionary > D-F > on endSprite |  |

on endSprite

Syntax

    on endSprite
    	statement(s)
    end

Description

System message and event handler; contains Lingo that runs when the playback head leaves a sprite and goes to a frame in which the sprite doesn't exist. It is generated after`exitFrame`.

Place `on endSprite` handlers in a behavior script.

Director destroys instances of any behavior scripts attached to the sprite immediately after the `endSprite` event occurs.

The event handler is passed the behavior or frame script reference `me` if used in a behavior. This `endSprite` message is sent after the `exitFrame` message if the playback head plays to the end of the frame.

The `go`, `play`, and `updateStage` commands are disabled in an `on endSprite` handler.

Example

This handler runs when the playback head exits a sprite:

    on endSprite me
    	-- clean up
    	gNumberOfSharks = gNumberOfSharks - 1
    	puppetSound(5,0)
    end

See also

`on beginSprite`, `on exitFrame`