534
C-Level Extensibility
Integrating C functions
The C-level extensibility mechanism lets you implement Flash extensibility files using a
combination of JavaScript and C code. The process for implementing this capability is
summarized in the following steps:
1.
Define functions using the C or C++ language.
2.
Bundle them in a DLL file (Windows) or a shared library (Macintosh).
3.
Save the DLL file or library in the appropriate location:
■
Windows 2000 or Windows XP:
boot drive
\Documents and Settings\
user
\Local Settings\Application
Data\Macromedia\ Flash 8\
language
\Configuration\External Libraries
■
Macintosh OS X:
Macintosh HD/Users/
userName
/Library/Application Support/Macromedia/Flash 8/
language
/Configuration/External Libraries
4.
Create a JSFL file that calls the functions.
5.
Run the JSFL file from the Commands menu in the Flash authoring environment.
For more information, see
“Sample DLL implementation” on page 540
.
C-level extensibility and the JavaScript interpreter
The C code in the DLL or shared library interacts with the Flash JavaScript API at three
different times:
■
At startup, to register the library’s functions
■
When the C function is called, to unpack the arguments that are being passed from
JavaScript to C
■
Before the C function returns, to package the return value
To accomplish these tasks, the interpreter defines several data types and exposes an API.
Definitions for the data types and functions that are listed in this section appear in the
mm_jsapi.h file. For your library to work properly, you must include the mm_jsapi.h file at
the top of each file in your library, with the following line:
#include "mm_jsapi.h"
Including the mm_jsapi.h file includes the mm_jsapi_environment.h file, which defines the
MM_Environment structure.
Summary of Contents for FLASH 8-EXTENDING FLASH
Page 1: ...Extending Flash...
Page 38: ...38 Top Level Functions and Methods...
Page 532: ...532 Objects...
Page 554: ...554 C Level Extensibility...