Sprite object

The Sprite object allows you to access the properties of your animations. Sprite objects can be queried using the GetSpriteObject methods of various objects and their equivalents.


Методы

Actions
GetFrame Returns one animation frame.
AddFrame Adds a new frame to the animation.
InsertFrame Inserts a new frame to the animation.
DeleteFrame Removes specified animation frame.
Reset Resets the animation.
Pause Pauses the animation.
Play Resumes a paused animation.
Функции для работы со сценариями
AttachScript Выполняет файл сценария и прикрепляет его к объекту.
DetachScript Выгружает из памяти файл сценария и удаляет его связку с объектом.
IsScriptRunning Выясняет, прикреплён ли указанный файл сценария к объекту.
CanHandleMethod Выясняет, поддерживает ли объект метод с указанным именем.

Атрибуты

Type (только для чтения) Returns always "sprite"
Name The internal name of the sprite.
Filename (только для чтения) Returns the filename.
NumFrames (только для чтения) Returns the actual number of animation frames.
CurrentFrame Specifies the index of the currently playing animation frame.
PixelPerfect Specifies if this sprite uses pixel-perfect mouse-over detection.
Looping Specifies if this is a looping animation.
Owner (только для чтения) Returns an object which owns this animation.
Finished (только для чтения) Returns true if the animation already finished playing.
Paused (только для чтения) Returns true if the animation is paused.

Низкоуровневые события

FrameChanged The sprite just switched to the next frame.

GetFrame(Index)

Returns one animation frame.

Параметры

Index
A zero-based index of the frame to be returned.

Возвращаемое значение

If the method succeeds it returns a frame object.


AddFrame(Filename)

Adds a new frame to the animation.

Параметры

Filename
An image file to be used for this frame.

Возвращаемое значение

Returns the newly created frame.


InsertFrame(Index, Filename)

Inserts a new frame to the animation.

Параметры

Index
The position where the new frame should be inserted.
Filename
An image file to be used for this frame.

Возвращаемое значение

Returns the newly created frame.


DeleteFrame(Index)
DeleteFrame(Frame)

Removes specified animation frame.

Параметры

Index
A zero-based index of a frame to be removed.
Frame
The frame object to be removed.

Reset()

Resets the animation.


Pause()

Pauses the animation.


Play()

Resumes a paused animation.


AttachScript(Filename)

Выполняет файл сценария и прикрепляет его к объекту.

Параметры

Filename
Имя файла сценария.

Возвращаемое значение

Возвращает true, если сценарий был успешно выполнен.

Примечания

К каждому объекту WME можно прикреплять несколько сценариев.


DetachScript(Filename, KillThreads)

Выгружает из памяти файл сценария и удаляет его связку с объектом.

Параметры

Filename
Имя файла сценария.
KillThreads
Указывает, нужно ли выгружать из памяти всё запущенные экземляры (threads) этого сценария (необязательный параметр, по умолчанию = false)

Возвращаемое значение

В случае удачного выполнения, метод вернёт значение true.

Примечания

Экземпляры сценария (threads) - это исполняемые в настоящий момент обработчики событий и методы, которые тем или иным образом включают в себя выполнение данного сценария.


IsScriptRunning(Filename)

Выясняет, прикреплён ли указанный файл сценария к объекту.

Параметры

Filename
Имя файла сценария.

Возвращаемое значение

Возвращает true, если указанный сценарий прикреплён к объекту.


CanHandleMethod(MethodName)

Выясняет, поддерживает ли объект метод с указанным именем.

Параметры

MethodName
Название метода.

Возвращаемое значение

Возвращает true, если объект поддерживает метод с указанным именем.