Adobe Extending Flash Professional CS4 Manuale Utente Pagina 551

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 560
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 550
529
EXTENDING FLASH CS4 PROFESSIONAL
C-Level Extensibility
typedef JSBool (*JSNative)(JSContext *cx, JSObject *obj, unsigned int argc,
jsval *argv, jsval *rval)
Description
Method; describes C-level implementations of JavaScript functions in the following situations:
The cx pointer is a pointer to an opaque JSContext structure, which must be passed to some of the functions in
the JavaScript API. This variable holds the interpreter’s execution context.
The obj pointer 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.
The argc integer is the number of arguments being passed to the function.
The argv pointer is a pointer to an array of jsval structures. The array is argc elements in length.
The rval pointer is a pointer to a single jsval structure. The function’s return value should be written to *rval.
The function returns JS_TRUE if successful; JS_FALSE otherwise. If the function returns JS_FALSE, the current script
stops executing and an error message appears.
JSBool JS_DefineFunction()
Usage
JSBool JS_DefineFunction(unsigned short *name, JSNative call, unsigned int nargs)
Description
Method; registers a C-level function with the JavaScript interpreter in Flash. After the JS_DefineFunction()
function registers the C-level function that you specify in the call argument, you can invoke it in a JavaScript script by
referring to it with the name that you specify in the name argument. The name argument is case-sensitive.
Typically, this function is called from the MM_Init() function, which Flash calls during startup.
Arguments
unsigned short *name, JSNativecall, unsigned int nargs
The name argument is the name of the function as it is exposed to JavaScript.
The call argument is a pointer to a C-level function. The function must return a JSBool, which indicates success or
failure.
The nargs argument is the number of arguments that the function expects to receive.
Returns
A Boolean value: JS_TRUE indicates success; JS_FALSE indicates failure.
unsigned short *JS_ValueToString()
Usage
unsigned short *JS_ValueToString(JSContext *cx, jsval v, unsigned int *pLength)
Vedere la pagina 550
1 2 ... 546 547 548 549 550 551 552 553 554 555 556 ... 559 560

Commenti su questo manuale

Nessun commento