beautypg.com

Chapter 51: c-level extensibility, About extensibility, Integrating c functions – Adobe Extending Flash Professional CS5 User Manual

Page 550: C-level extensibility

background image

528

Last updated 5/2/2011

Chapter 51: C-Level Extensibility

This chapter describes the C-level extensibility mechanism, which lets you implement Adobe Flash CS4 Professional
extensibility files using a combination of JavaScript and custom C code. No changes to the mechanism have been
introduced in this release of Flash.

About extensibility

To implement extensibility, you define functions using C, bundle them in a dynamic linked library (DLL) or a shared
library, save the library in the appropriate directory, and then call the functions from JavaScript using the Adobe Flash
JavaScript API.

For example, you might want to define a function that performs intense calculations more efficiently than JavaScript
does, which improves performance, or when you want to create more advanced tools or effects.

This extensibility mechanism is a subset of the Adobe Dreamweaver CS3 API. If you are familiar with that API, you
might recognize the functions in the C-level extensibility mechanism API. However, this API differs from the
Dreamweaver API in the following ways:

This API does not contain all the commands in the Dreamweaver API.

All declarations of type

wchar_t

and

char

in the Dreamweaver API are implemented as

unsigned short

declarations in this API, to support Unicode when strings are passed.

The

JSVal JS_BytesToValue()

function in this API is not part of the Dreamweaver API.

The location in which the DLL or shared library files must be stored is different (see

Integrating C functions

” on

page 528).

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 7:

boot drive\Users\username\AppData\Adobe\Flash CS5 or CS5.5\language\Configuration\External Libraries

Windows Vista:

boot drive\Users\username\Local Settings\Application Data\Adobe\Flash CS5 or
CS5.5
\language\Configuration\External Libraries

Windows XP:

boot drive\Documents and Settings\username\Local Settings\Application Data\Adobe\Flash CS5 or
CS5.5
\language\Configuration\External Libraries

This manual is related to the following products: