NativeClip
Defined in: client/api.d.ts:2912
One display object inside a native screen: a clip, an attached sprite or a text field.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”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.
Parameters
Section titled “Parameters”screen
Section titled “screen”number
Screen this handle belongs to.
string
Handle key inside that screen.
Returns
Section titled “Returns”NativeClip
Methods
Section titled “Methods”attach()
Section titled “attach()”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.
Parameters
Section titled “Parameters”exportName
Section titled “exportName”string
Linkage name of a sprite the screen’s library exports.
Returns
Section titled “Returns”NativeClip | null
The new child, or null when the library has no such export.
createClip()
Section titled “createClip()”createClip():
NativeClip|null
Defined in: client/api.d.ts:2951
Creates an empty child clip, for grouping and for drawing into.
Returns
Section titled “Returns”NativeClip | null
The new child, or null when the screen is not composed.
createText()
Section titled “createText()”createText(
options):NativeClip|null
Defined in: client/api.d.ts:2958
Creates a native text field as a child of this clip.
Parameters
Section titled “Parameters”options
Section titled “options”Where the field goes in this clip’s own coordinates, how big it is, and what it starts with.
height
Section titled “height”number
string
string
number
number
number
Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”member
Section titled “member”string
ActionScript property name, such as _width or _currentframe.
Returns
Section titled “Returns”any
The value, or null when it is absent or not a scalar.
getText()
Section titled “getText()”getText(
html?):string|null
Defined in: client/api.d.ts:3002
Reads this field’s text back.
Parameters
Section titled “Parameters”boolean
Read the generated markup instead of the plain text.
Returns
Section titled “Returns”string | null
The text, or null when there is none to read.
goto()
Section titled “goto()”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.
Parameters
Section titled “Parameters”frameOrLabel
Section titled “frameOrLabel”string | number
A one-based frame number, or a frame label.
boolean
Keep playing from there instead of stopping.
Returns
Section titled “Returns”boolean
True when the frame or label resolved.
invoke()
Section titled “invoke()”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.
Parameters
Section titled “Parameters”method
Section titled “method”string
Method name on this object.
(string | number | boolean | null)[]
Scalar arguments. They may also be passed loose, one per parameter.
Returns
Section titled “Returns”any
What ActionScript returned, or null when the call failed.
load()
Section titled “load()”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.
Parameters
Section titled “Parameters”string
img:// or imgps:// for the engine’s image loader, or a movie path inside the mounted archive.
Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”string
The handler to take off.
Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”"press" | "release" | "releaseOutside" | "rollOver" | "rollOut" | "dragOver" | "dragOut"
Which mouse handler to install.
handler
Section titled “handler”NativeClipHandler<NativeClip>
Called on the next tick after the movie raises it.
Returns
Section titled “Returns”boolean
True when the handler was installed.
remove()
Section titled “remove()”remove():
boolean
Defined in: client/api.d.ts:3059
Takes this display object out of the screen, with its handlers.
Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”options
Section titled “options”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.
alpha?
Section titled “alpha?”number
rotation?
Section titled “rotation?”number
scaleX?
Section titled “scaleX?”number
scaleY?
Section titled “scaleY?”number
visible?
Section titled “visible?”boolean
number
number
Returns
Section titled “Returns”boolean
True when the movie accepted the update.
setHitArea()
Section titled “setHitArea()”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.
Parameters
Section titled “Parameters”NativeClip | null
A clip from this same screen, or null to clear.
Returns
Section titled “Returns”boolean
True when the movie took the binding.
setMask()
Section titled “setMask()”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.
Parameters
Section titled “Parameters”NativeClip | null
A clip from this same screen, or null to clear.
Returns
Section titled “Returns”boolean
True when the movie took the binding.
setMember()
Section titled “setMember()”setMember(
member,value):boolean
Defined in: client/api.d.ts:2980
Assigns one scalar property on this display object.
Parameters
Section titled “Parameters”member
Section titled “member”string
ActionScript property name.
string | number | boolean | null
What to assign.
Returns
Section titled “Returns”boolean
True when the movie accepted it.
setText()
Section titled “setText()”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.
Parameters
Section titled “Parameters”string
The text to show.
boolean
Parse it as the engine’s HTML subset instead of plain text.
Returns
Section titled “Returns”boolean
True when the movie accepted the write.
setTextStyle()
Section titled “setTextStyle()”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.
Parameters
Section titled “Parameters”options
Section titled “options”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.
align?
Section titled “align?”"left" | "center" | "right" | "justify"
boolean
color?
Section titled “color?”number
string
italic?
Section titled “italic?”boolean
number
Returns
Section titled “Returns”boolean
True when the movie accepted the format.
toString()
Section titled “toString()”toString():
string
Defined in: client/api.d.ts:2938
Formats this handle for logging.
Returns
Section titled “Returns”string
Properties
Section titled “Properties”
readonlykey:string
Defined in: client/api.d.ts:2928
The screen-local key this handle resolves through.
screen
Section titled “screen”
readonlyscreen:number
Defined in: client/api.d.ts:2923
Identifier of the screen this handle belongs to.
readonlyvalid: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.