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.


Methods

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.
Script functions
AttachScript Executes a script file and attaches it to the object.
DetachScript Terminates a specified script file and detaches it from an object.
IsScriptRunning Queries whether a specified script file is running and attached to an object.
CanHandleMethod Queries whether the object supports a method of a specified name.

Attributes

Type (read only) Returns always "sprite"
Name The internal name of the sprite.
Filename (read only) Returns the filename.
NumFrames (read only) 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 (read only) Returns an object which owns this animation.
Finished (read only) Returns true if the animation already finished playing.
Paused (read only) Returns true if the animation is paused.

Low level events

FrameChanged The sprite just switched to the next frame.

GetFrame(Index)

Returns one animation frame.

Parameters

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

Return value

If the method succeeds it returns a frame object.


AddFrame(Filename)

Adds a new frame to the animation.

Parameters

Filename
An image file to be used for this frame.

Return value

Returns the newly created frame.


InsertFrame(Index, Filename)

Inserts a new frame to the animation.

Parameters

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

Return value

Returns the newly created frame.


DeleteFrame(Index)
DeleteFrame(Frame)

Removes specified animation frame.

Parameters

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)

Executes a script file and attaches it to the object.

Parameters

Filename
The filename of the script file to be executed.

Return value

Returns true if the script has been executed succesfuly.

Remarks

Each WME object can have multiple scripts attached.


DetachScript(Filename, KillThreads)

Terminates a specified script file and detaches it from an object.

Parameters

Filename
The filename of the (running) script to be terminated and detached.
KillThreads
Specifies whether to terminate all running threads of this script (optional, default=false)

Return value

Returns true if the script has been detached succesfully.

Remarks

Script threads are currently executed event handlers and methods.


IsScriptRunning(Filename)

Queries whether a specified script file is running and attached to an object.

Parameters

Filename
The filename of the script to be queried.

Return value

Returns true if a specified script file is attached to an object.


CanHandleMethod(MethodName)

Queries whether the object supports a method of a specified name.

Parameters

MethodName
The name of the method to be checked.

Return value

Returns true if the object is able to handle the specified method.