Adobe Extending Flash Professional CS5 Manuale Utente Pagina 554

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 565
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 553
532
EXTENDING FLASH PROFESSIONAL
C-Level Extensibility
Last updated 5/2/2011
#ifdef _WIN32
# ifndef _MAC
// 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 12.) 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 528).
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 553
1 2 ... 549 550 551 552 553 554 555 556 557 558 559 ... 564 565

Commenti su questo manuale

Nessun commento