Jsbool js_setelement(), Jsbool js_executescript() – Adobe Extending Flash Professional CS5 User Manual

Page 564

Advertising
background image

542

EXTENDING FLASH PROFESSIONAL

C-Level Extensibility

Last updated 5/2/2011

The vp argument is a pointer to a

jsval

where the contents of the

jsval

structure in the array should be copied.

Returns
A Boolean value:

JS_TRUE

indicates success;

JS_FALSE

indicates failure.

JSBool JS_SetElement()

Usage

JSBool JS_SetElement(JSContext *cx, JSObject *obj, jsint idx, jsval *vp)

Description
Method; writes a single element of an array object.

Arguments

JSContext

*cx

, JSObject

*obj

, jsint

idx

, jsval

*vp

The cx argument is the opaque

JSContext

pointer that passes to the JavaScript function.

The obj argument is a pointer to an array object.

The idx argument is an integer index into the array. The first element is index

0

, and the last element is index

(

length 1

-).

The vp argument is a pointer to a

jsval

structure whose contents should be copied to the

jsval

in the array.

Returns
A Boolean value:

JS_TRUE

indicates success;

JS_FALSE

indicates failure.

JSBool JS_ExecuteScript()

Usage

JS_ExecuteScript (JSContext *cx, JSObject *obj, unsigned short *script, unsigned int sz, jsval

*rval)

Description
Method; compiles and executes a JavaScript string. If the script generates a return value, it returns in

*rval

.

Arguments

JSContext

*cx,

JSObject

*obj,

unsigned short

*script,

unsigned int

sz,

jsval

*rval

The cx argument is the opaque

JSContext

pointer that passes to the JavaScript function.

The obj argument is a pointer to the object in whose context the script executes. While the script is running, the

this

keyword is equal to this object. Usually this is the

JSObject

pointer that passes to the JavaScript function.

The script argument is a string that contains JavaScript code. If the string size is not specified (see the sz argument),
the string must be null-terminated.

Advertising
This manual is related to the following products: