Data Types - MACROMEDIA FLASH MX 2004-FLASH JAVASCRIPT DICTIONARY Manual

Flash javascript dictionary
Hide thumbs Also See for FLASH MX 2004-FLASH JAVASCRIPT DICTIONARY:
Table of Contents

Advertisement

long a, b, sum;
// Make sure the right number of arguments were passed in
if (argc != 2)
return JS_FALSE;
// Convert the two arguments from jsvals to longs
if (JS_ValueToInteger(cx, argv[0], &a) == JS_FALSE ||
JS_ValueToInteger(cx, argv[1], &b) == JS_FALSE)
return JS_FALSE;
/* Perform the actual work */
sum = a + b;
/* Package the return value as a jsval */
*rval = JS_IntegerToValue(sum);
/* Indicate success */
return JS_TRUE;
}
After writing this code, build the DLL file or shared library, and store it in the appropriate
External Libraries directory (see
a JSFL with the following code, and store it in the Commands directory (see
Macromedia Flash JavaScript API" on page
// JSFL file to run C function defined above
var a = 5;
var b = 10;
var sum = Sample.computeSum(a, b);
fl.trace("The sum of " + a + " and " + b + " is " + sum );
To run the function defined in the DLL, select Commands > Sample in the Flash authoring
environment.

Data types

The JavaScript interpreter defines the following data types:
JSContext
JSObject
jsval
JSBool
typedef struct JSContext JSContext
A pointer to this opaque data type passes to the C-level function. Some functions in the API
accept this pointer as one of their arguments.
typedef struct JSObject JSObject
A pointer to this opaque data type passes to the C-level function. This data type represents an
object, which might be an array object or some other object type.
"How integrating C functions works" on page
17).
369). Then create
"Overview of the
Data types
375

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-FLASH JAVASCRIPT DICTIONARY and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx 2004 - actionscript

Table of Contents