clone

Typecommand
DictionaryLCS
LibraryLiveCode Script
Syntax
clone [invisible] <object> [as <newName>]
Summary

Duplicates an object.

Introduced1.0
OSmac, windows, linux, ios, android
Platformsdesktop, server
Parameters
NameTypeDescription
object

An object or stack reference or an expression that resolves to either.

newName

An optional name for the new object.

Example
clone field 1
clone the selectedObject
clone this card as "clonedCard"
clone invisible stack "myStack"
Values
NameTypeDescription
It

The clone command places the long id property of the newly created object in the it variable.

RelatedProperty: pixels, properties, name
Message: newAudioclip, newButton, newCard, newGroup, newPlayer, newGraphic, newField, newScrollbar, newEPS, newImage, newVideoclip
Keyword: card, control, it
Glossary: object, grouped control, current card, owner, command
Function: clipboard
Command: create card, paste, group, copy, create stack
Object: stack
Description

Use the clone command to create a copy of an existing object.

If the object is a control, its copy is placed on the current card, 32 pixels below and to the right of the original object. The copy's name and other properties are the same as those of the original. If the object is a groupedcontrol, the clone is also owned by the group.

Note: If invisible is specified the new object will have its visible property set to false.

If the object is a card, the copy becomes the current card.

If the object is a stack, the newly created stack is opened. It is named "Copy of" and the stack's name.

The clone command does not affect the contents of the clipboard.

If the 'as' variant is used, the newly created object is given the specified name.