Adobe Extending Flash Professional CS4 Manuale Utente Pagina 548

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 560
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 547
526
EXTENDING FLASH CS4 PROFESSIONAL
C-Level Extensibility
// Windows
__declspec( dllexport ) void MM_InitWrapper( MM_Environment *env, unsigned int envSize );
# endif
#else
extern void MM_InitWrapper( MM_Environment *env, unsigned int envSize );
#endif
#define MM_STATE\
/* Definitions of global variables */ \
MM_Environment mmEnv; \
\
void\
MM_InitWrapper(MM_Environment *env, unsigned int envSize) \
{ \
extern void MM_Init();\
\
char **envPtr = (char **)env; \
char **mmPtr =(char **)(&mmEnv);\
char **envEnd = (char **)((char *)envPtr + envSize);\
char **mmEnd =(char **)((char *)mmPtr+ sizeof(MM_Environment)); \
\
/* Copy fields from env to mmEnv, one pointer at a time */\
while (mmPtr < mmEnd && envPtr < envEnd)\
*mmPtr++ = *envPtr++; \
\
/* If env doesn't define all of mmEnv's fields, set extras to NULL */ \
while (mmPtr < mmEnd) \
*mmPtr++ = (char *)0; \
\
/* Call user's MM_Init function */\
MM_Init();\
} \
#endif /* _MM_JSAPI_H_ */
Sample DLL implementation
This section illustrates how to build a simple DLL implementation. If you want to see how the process works without
actually building the DLL yourself, you can install the sample DLL files that are provided in the Samples.zip file; the
files are located in the ExtendingFlash/dllSampleComputeSum folder. (For information on downloading the
Samples.zip file, see
Sample implementations” on page 13.) Extract the sample files from the
dllSampleComputeSum.dmg or dllSampleComputeSum.zip file, and then do the following:
Store the Sample.jsfl file in the Configuration/Commands directory (see “Saving JSFL files” on page 2).
Store the Sample.dll file in the Configuration/External Libraries directory (see “Integrating C functions” on
page 522).
In the Flash authoring environment, select Commands > Sample. The trace statement in the JSFL file sends the
results of the function defined in Sample.dll to the Output panel.
The rest of this section discusses the development of the sample. In this case, the DLL contains only one function,
which adds two numbers. The C code is shown in the following example:
Vedere la pagina 547
1 2 ... 543 544 545 546 547 548 549 550 551 552 553 ... 559 560

Commenti su questo manuale

Nessun commento