Skip to content
KCKingdoms Connected Scripting APIScripting guides and API
Runtime classClient APIGenerated

NativeClip

Defined in: client/api.d.ts:2912

One display object inside a native screen: a clip, an attached sprite or a text field.

new NativeClip(screen, key): NativeClip

Defined in: client/api.d.ts:2918

Rebuilds a handle for a display object that already exists. Clips come from screen.root and the create calls on it.

number

Screen this handle belongs to.

string

Handle key inside that screen.

NativeClip

attach(exportName): NativeClip | null

Defined in: client/api.d.ts:2945

Attaches one of the game’s own exported sprites as a child of this clip. Which names exist depends on the library the screen was opened with.

string

Linkage name of a sprite the screen’s library exports.

NativeClip | null

The new child, or null when the library has no such export.


createClip(): NativeClip | null

Defined in: client/api.d.ts:2951

Creates an empty child clip, for grouping and for drawing into.

NativeClip | null

The new child, or null when the screen is not composed.


createText(options): NativeClip | null

Defined in: client/api.d.ts:2958

Creates a native text field as a child of this clip.

Where the field goes in this clip’s own coordinates, how big it is, and what it starts with.

number

string

string

number

number

number

NativeClip | null

The new field, or null when the screen is not composed.


get(member): any

Defined in: client/api.d.ts:2972

Reads one scalar property off this display object. Property access can run an ActionScript getter.

string

ActionScript property name, such as _width or _currentframe.

any

The value, or null when it is absent or not a scalar.


getText(html?): string | null

Defined in: client/api.d.ts:3002

Reads this field’s text back.

boolean

Read the generated markup instead of the plain text.

string | null

The text, or null when there is none to read.


goto(frameOrLabel, play?): boolean

Defined in: client/api.d.ts:3010

Moves this clip’s own timeline. A timeline change can replace named children, so reacquire anything below it afterwards.

string | number

A one-based frame number, or a frame label.

boolean

Keep playing from there instead of stopping.

boolean

True when the frame or label resolved.


invoke(method, args?): any

Defined in: client/api.d.ts:3018

Calls a method on this display object. Only scalars cross, and the result is a scalar.

string

Method name on this object.

(string | number | boolean | null)[]

Scalar arguments. They may also be passed loose, one per parameter.

any

What ActionScript returned, or null when the call failed.


load(url): boolean

Defined in: client/api.d.ts:3053

Loads an external image or movie into this clip, replacing what it holds. A missing asset installs the engine’s placeholder rather than failing, so a true result is not an existence check.

string

img:// or imgps:// for the engine’s image loader, or a movie path inside the mounted archive.

boolean

True when the request was accepted.


off(event): void

Defined in: client/api.d.ts:3032

Removes one mouse handler, deleting the ActionScript member rather than assigning null to it.

string

The handler to take off.

void


on(event, handler): boolean

Defined in: client/api.d.ts:3026

Installs one ActionScript mouse handler on this clip and enables it as a mouse target. The screen also has to hold input focus for the mouse to reach it.

"press" | "release" | "releaseOutside" | "rollOver" | "rollOut" | "dragOver" | "dragOut"

Which mouse handler to install.

NativeClipHandler<NativeClip>

Called on the next tick after the movie raises it.

boolean

True when the handler was installed.


remove(): boolean

Defined in: client/api.d.ts:3059

Takes this display object out of the screen, with its handlers.

boolean

True when it was still there to remove.


set(options): boolean

Defined in: client/api.d.ts:2965

Moves, scales, rotates, fades or hides this display object.

Only the fields present are applied. Position is in stage units, rotation in degrees, scale as a multiplier where 1 is natural size, alpha from 0 to 1.

number

number

number

number

boolean

number

number

boolean

True when the movie accepted the update.


setHitArea(area): boolean

Defined in: client/api.d.ts:3046

Makes another clip the region this one is clicked through, for a target whose artwork is the wrong shape to click.

NativeClip | null

A clip from this same screen, or null to clear.

boolean

True when the movie took the binding.


setMask(mask): boolean

Defined in: client/api.d.ts:3039

Binds another clip as this one’s mask. One mask belongs to one target: binding it elsewhere detaches it from here.

NativeClip | null

A clip from this same screen, or null to clear.

boolean

True when the movie took the binding.


setMember(member, value): boolean

Defined in: client/api.d.ts:2980

Assigns one scalar property on this display object.

string

ActionScript property name.

string | number | boolean | null

What to assign.

boolean

True when the movie accepted it.


setText(text, html?): boolean

Defined in: client/api.d.ts:2995

Writes this field’s text. On a clip rather than a field it assigns the text property, which is not the same as writing a field inside it.

string

The text to show.

boolean

Parse it as the engine’s HTML subset instead of plain text.

boolean

True when the movie accepted the write.


setTextStyle(options): boolean

Defined in: client/api.d.ts:2987

Sets how this field draws, for the text it holds and the text it is given next. A field created through createText already has the default applied; this restyles it.

font is one of the game’s own mapped names – DefaultFont, DefaultFontBold, DefaultFontItalic, LightFont, LightFontBold, LightFontItalic, DisplayFont, Manuscript – and not a face name. color is 0xRRGGBB.

"left" | "center" | "right" | "justify"

boolean

number

string

boolean

number

boolean

True when the movie accepted the format.


toString(): string

Defined in: client/api.d.ts:2938

Formats this handle for logging.

string

readonly key: string

Defined in: client/api.d.ts:2928

The screen-local key this handle resolves through.


readonly screen: number

Defined in: client/api.d.ts:2923

Identifier of the screen this handle belongs to.


readonly valid: boolean

Defined in: client/api.d.ts:2933

Whether the screen still holds this object. A handle to a removed object keeps reading and every call on it fails cleanly.