Lingo Dictionary > S > scriptInstanceList

 

scriptInstanceList

Syntax

sprite(whichSprite).scriptInstanceList
the scriptInstanceList of sprite whichSprite

Description

Sprite property; creates a list of script references attached to a sprite. This property is available only during run time. The list is empty when the movie is not running. Modifications to the list are not saved in the Score. This property is useful for the following tasks:

Attaching a behavior to a sprite for use during run time

Determining if behaviors are attached to a sprite; determining what the behaviors are

Finding a behavior script reference to use with the sendSprite command

This property can be tested and set. (It can be set only if the sprite already exists and has at least one instance of a behavior already attached to it.)

Example

This handler displays the list of script references attached to a sprite:

on showScriptRefs spriteNum
	put sprite(spriteNum).scriptInstanceList 
end

Example

These statements attach the script Big Noise to sprite 5:

x = script("Big Noise").new()
sprite(5).scriptInstanceList.add(x)

See also

scriptNum, sendSprite