Livecode Wiki
Advertisement

Places an object's script into the message path.

Built-in Message handler[]

Syntax:

insert [the] script of object into {front | back}

Examples:

insert the script of button "Message Library" into back
insert the script of this card into front


Use the insert script command to use an object's script as a library for frequently-used handlers.

A script inserted into the front receives messages first, before the target object receives them. A script inserted into the back receives messages after all objects in the message path, just before the engine itself receives the message.

Objects added to the front or back are placed at the start of the frontScripts or backScripts list: the last-inserted object gets messages first.

Be aware that inserting scripts may make it difficult to understand how a stack behaves. If you use this command for development, be sure to carefully document which scripts are inserted, where, and when.

See Also: call command, remove script command, place command, start using command

Advertisement