beautypg.com

Jsbool js_valuetoboolean(), Jsbool js_valuetoobject() – Adobe Extending Flash Professional CS5 User Manual

Page 559

background image

537

EXTENDING FLASH PROFESSIONAL

C-Level Extensibility

Last updated 5/2/2011

Arguments

JSContext

*cx,

jsval

v,

double

*dp

The cx argument is the opaque

JSContext

pointer that passed to the JavaScript function.

The v argument is the

jsval

structure from which the double is to be extracted.

The dp argument is a pointer to an 8-byte double. This function stores the converted value in

*dp

.

Returns
A Boolean value:

JS_TRUE

indicates success;

JS_FALSE

indicates failure.

JSBool JS_ValueToBoolean()

Usage

JSBool JS_ValueToBoolean(JSContext *cx, jsval v, JSBool *bp);

Description
Method; extracts a function argument from a

jsval

structure, converts it to a Boolean value (if possible), and passes

the converted value back to the caller.

Arguments

JSContext

*cx,

jsval

v,

JSBool

*bp

The cx argument is the opaque

JSContext

pointer that passes to the JavaScript function.

The v argument is the

jsval

structure from which the Boolean value is to be extracted.

The bp argument is a pointer to a

JSBool

Boolean value. This function stores the converted value in

*bp

.

Returns
A Boolean value:

JS_TRUE

indicates success;

JS_FALSE

indicates failure.

JSBool JS_ValueToObject()

Usage

JSBool JS_ValueToObject(JSContext *cx, jsval v, JSObject **op);

Description
Method; extracts a function argument from a

jsval

structure, converts it to an object (if possible), and passes the

converted value back to the caller. If the object is an array, use

JS_GetArrayLength()

and

JS_GetElement()

to read

its contents.

Arguments

JSContext

*cx,

jsval

v,

JSObject

**op

The cx argument is the opaque

JSContext

pointer that passes to the JavaScript function.

The v argument is the

jsval

structure from which the object is to be extracted.

The op argument is a pointer to a

JSObject

pointer. This function stores the converted value in

*op

.

This manual is related to the following products: