target

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
the target
target()
Summary

Returns the object which received the message that started execution.

Introduced1.0
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Example
the target
if word 1 of the target is "button" then clickedAButton
set the backgroundColor of the target to "black"
Values
NameTypeDescription
return

The target function returns the name property of the object.

RelatedProperty: script, name, text
Message: mouseDown
Keyword: me, target, button
Object: card, button
Function: dragSource, dragDestination, selectedObject
Glossary: return, property, handle, handler, execute, pass, message, card, keyword, object reference, object
Control Structure: function
Description

Use the target function within a message handler to determine which object originally received the message.

Suppose a card script contains a mouseDown handler. If the user clicks a button, a mouseDown message is sent to the button. If the button's script does not contain a mouseDown handler, the message is passed to the card, and handled by the card's mouseDown handler.

The target function is similar to the me keyword. In the example described above, within the card's handler, the target function returns the button's name, because the button is the object that first received the mouseDown message. However, the me keyword is a reference to the card, because the card is the object whose script contains the mouseDown handler that is executing.

Tagsobjects