beautypg.com

Jsbool js_stringtovalue(), Jsbool js_doubletovalue() – Adobe Extending Flash Professional CS5 User Manual

Page 560

background image

538

EXTENDING FLASH PROFESSIONAL

C-Level Extensibility

Last updated 5/2/2011

Returns
A Boolean value:

JS_TRUE

indicates success;

JS_FALSE

indicates failure.

JSBool JS_StringToValue()

Usage

JSBool JS_StringToValue(JSContext *cx, unsigned short *bytes, uint sz, jsval *vp);

Description
Method; stores a string return value in a

jsval

structure. It allocates a new JavaScript string object.

Arguments

JSContext

*cx,

unsigned short *

bytes,

size_t

sz,

jsval

*vp

The cx argument is the opaque

JSContext

pointer that passes to the JavaScript function.

The bytes argument is the string to be stored in the

jsval

structure. The string data is copied, so the caller should

free the string when it is not needed. If the string size is not specified (see the sz argument), the string must be
null-terminated.

The sz argument is the size of the string, in bytes. If sz is 0, the length of the null-terminated string is computed
automatically.

The vp argument is a pointer to the

jsval

structure into which the contents of the string should be copied.

Returns
A Boolean value:

JS_TRUE

indicates success;

JS_FALSE

indicates failure.

JSBool JS_DoubleToValue()

Usage

JSBool JS_DoubleToValue(JSContext *cx, double dv, jsval *vp);

Description
Method; stores a floating-point number return value in a

jsval

structure.

Arguments

JSContext

*cx,

double

dv,

jsval

*vp

The cx argument is the opaque

JSContext

pointer that passes to the JavaScript function.

The dv argument is an 8-byte floating-point number.

The vp argument is a pointer to the

jsval

structure into which the contents of the double should be copied.

Returns
A Boolean value:

JS_TRUE

indicates success;

JS_FALSE

indicates failure.

This manual is related to the following products: