GlobalAPI

GlobalAPI

new GlobalAPI(scriptOwner)

Source:
Parameters:
Name Type Description
scriptOwner object

The tickable object which owns the script being evaluated.

Members

(static) apiMemberNames :Array.<string>

Description:
  • Defines all api members such as functions and properties.

Source:

Defines all api members such as functions and properties.

Type:
  • Array.<string>

apiMembers

Description:
  • Returns a list of api members bound to the script owner.

Source:

Returns a list of api members bound to the script owner.

key

Description:
  • Returns the last key pressed down.

Source:

Returns the last key pressed down.

keys

Description:
  • Returns a list of all keys currently pressed down.

Source:

Returns a list of all keys currently pressed down.

mouseMoveX

Description:
  • Returns the amount the mouse moved in the last tick on the x axis.

Source:

Returns the amount the mouse moved in the last tick on the x axis.

mouseMoveY

Description:
  • Returns the amount the mouse moved in the last tick on the y axis.

Source:

Returns the amount the mouse moved in the last tick on the y axis.

mouseX

Description:
  • Returns the current x position of the mouse in relation to the canvas.

Source:

Returns the current x position of the mouse in relation to the canvas.

mouseY

Description:
  • Returns the current y position of the mouse in relation to the canvas.

Source:

Returns the current y position of the mouse in relation to the canvas.

parent

Description:
  • Returns a reference to the current object's parent.

Source:

Returns a reference to the current object's parent.

parentObject

Source:
Deprecated:
  • Legacy item which returns the parent clip. Use 'parent' instead.

project

Description:
  • Returns an object representing the project with properties such as width, height, framerate, background color, and name.

Source:

Returns an object representing the project with properties such as width, height, framerate, background color, and name.

random

Description:
  • Returns a new random object.

Source:

Returns a new random object.

root

Source:
Deprecated:
  • Legacy item which returns the project. Use 'project' instead.

Methods

gotoAndPlay(frame)

Description:
  • Moves the plahead of the parent clip to a frame and plays the timeline of that parent clip.

Source:
Parameters:
Name Type Description
frame string | number

Frame name or number to move playhead to.

gotoAndStop(frame)

Description:
  • Moves the plahead of the parent clip to a frame and stops the timeline of that parent clip.

Source:
Parameters:
Name Type Description
frame string | number

Frame name or number to move playhead to.

gotoNextFrame()

Description:
  • Moves the playhead of the parent clip of the object to the next frame.

Source:

gotoPrevFrame()

Description:
  • Moves the playhead of the parent clip of this object to the previous frame.

Source:

hideCursor()

Description:
  • Hide the cursor while the project is running.

Source:

isKeyDown(key) → {bool}

Description:
  • Returns true if the given key is currently down.

Source:
Parameters:
Name Type Description
key string
Returns:
Type
bool

isKeyJustPressed(key) → {bool}

Description:
  • Returns true if the given key was just pressed within the last tick.

Source:
Parameters:
Name Type Description
key string
Returns:
Type
bool

isMouseDown() → {bool|null}

Description:
  • Returns true if the mouse is currently held down.

Source:
Returns:

Returns null if the object does not have a project.

Type
bool | null

keyIsDown()

Source:
Deprecated:
  • Legacy item, use 'isKeyDown' instead.

keyIsJustPressed()

Source:
Deprecated:
  • Legacy item, use 'isKeyJustPressed' instead.

onEvent(name, fn)

Description:
  • Attach a function to an event with a given name.

Source:
Parameters:
Name Type Description
name string

the name of the event to attach the function to

fn function

the function to attach to the event

play()

Description:
  • Plays the timeline of the object's parent clip.

Source:

playSound(name, options) → {object}

Description:
  • Plays a sound which is currently in the asset library.

Source:
Parameters:
Name Type Description
name string

name of the sound asset in the library.

options Object

options for the sound. See Wick.SoundAsset.play

Returns:

object representing the sound which was played.

Type
object

showCursor()

Description:
  • Don't hide the cursor while the project is running.

Source:

stop()

Description:
  • Stops the timeline of the object's parent clip.

Source:

stopAllSounds()

Description:
  • Stops all currently playing sounds.

Source:

stopSound(assetName, id)

Description:
  • Stops sound(s) currently playing.

Source:
Parameters:
Name Type Description
assetName string

The name of the SoundAsset to stop.

id number

(optional) The ID of the sound to stop. Returned by playSound. If an ID is not given, all instances of the given sound asset will be stopped.