Library.itemexists() – Adobe Extending Flash Professional CS4 User Manual

Page 341

Advertising
background image

319

EXTENDING FLASH CS4 PROFESSIONAL

library object

Parameters

linkageName

A string that provides the name of the SWF linkage of the root movie clip.

swfData

An array of binary SWF data, which comes from an external library or DLL.

libName

A string that specifies the library name for the created item. If the name is already used, the method creates

an alternate name. This parameter is optional.

Returns
Nothing.

Description
Method; imports a SWF file into the library as a compiled clip. Unlike File > Import > SWF, this method lets you
embed a compiled SWF file inside the library. There is no corresponding user interface functionality, and this method
must be used with an external library or DLL (see “

C-Level Extensibility

” on page 522).

The SWF file that you are importing must have one top-level movie clip that contains all the content. That movie clip
should have its linkage identifier set to the same value as the linkageName parameter passed to this method.

Example
The following example adds the SWF file with the linkageName value of

MyMovie

to the library as a compiled clip

named

Intro

:

fl.getDocumentDOM().library.importEmbeddedSWF("MyMovie", swfData, "Intro");

library.itemExists()

Availability
Flash MX 2004.

Usage

library.itemExists(namePath)

Parameters

namePath

A string that specifies the name of the item. If the item is in a folder, specify its name and path using slash

notation.

Returns
A Boolean value:

true

if the specified item exists in the library;

false

otherwise.

Description
Method; checks to see if a specified item exists in the library.

Example
The following example displays

true

or

false

in a dialog box, depending on whether the item

Symbol_1

exists in the

Folder_1

library folder:

alert(fl.getDocumentDOM().library.itemExists('Folder_1/Symbol_1'));

Advertising